From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id rxADKJnKQmhAIAMAWB0awg (envelope-from ) for ; Fri, 06 Jun 2025 07:01:45 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=40DeZozA; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 8F9D51E11C; Fri, 6 Jun 2025 07:01:45 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-10.1 required=5.0 tests=ARC_SIGNED,ARC_VALID, BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED, RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE autolearn=ham autolearn_force=no version=4.0.1 Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 085C71E089 for ; Fri, 6 Jun 2025 07:01:44 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 82DC53856DEF for ; Fri, 6 Jun 2025 11:01:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 82DC53856DEF Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=40DeZozA Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on20601.outbound.protection.outlook.com [IPv6:2a01:111:f403:2009::601]) by sourceware.org (Postfix) with ESMTPS id 74BD33857B84 for ; Fri, 6 Jun 2025 11:00:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 74BD33857B84 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=amd.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 74BD33857B84 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:2009::601 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1749207633; cv=pass; b=S3on+T5EglbjXISkBpt4n3D4+xh1DF6Sjc3Y1dnyVD6s+cQ+14EROInW0T6VwnwQhX+6Bx1smpiD0x/x3oWjcES8Sop5+Xk04tY94RbXMcLdGFHRMKrSmPVGIhGqpCR/+yTI9SfSqQIh5V4dChRZp/79psqTBLKAtl4eJ80okrc= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1749207633; c=relaxed/simple; bh=WzDh4vhqYOZGh8oKrd2dim61zJlDwWKUhMH8updFJfU=; h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version; b=h1mAiKr//I6W3rbzpk621rzbjIsTUGo1e2iR84C0uYdPzvgbEFrLtBGLcVj4MoIADf/A/N3Y8PQWRmtlz2+OARk45UbVp2Kr6pnATuB+SAX+9Zi3REWfZHKuhxfHE73SI3m6OXKCsoWD4k3St3/zw6Hvmf5IThkKm4C96EBoMCE= ARC-Authentication-Results: i=2; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74BD33857B84 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o0yXuut/X+D5B5NqKmFi9OzQrowYr0UCczTIAItO2WNa83JDfwYYpJNQnAZnAZIJDrahzNrxposdQlqM9S17OKuEBl7sRA+JlgWGGZyOlAMxWwk1xn+if/bwuICMAdJK0QxMSsrihriAAdJQM8bYiCRgziUhZcJr79pLfV4USFP2R6xSYfhLcHUpYDlr2yncOXc4aY7SLlwrmKI3RpNJ1lMtOSjglrwyDGTg+QRhu0/PpVRSbZB8vRJ5L8QfqfdGovOE+b7ASUcKPCZLQo+WpLgaBpq4EKs2O4t35f3W9KZokwcOnotHakYNYRYFp48UoCzlUyWbJeBcirs2e45Dhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=x05E2GcqncoaU1anPZCs+KyGiP1VouRf3Jk5LHe6XOk=; b=FB5IUe8fwJ1hyM3nGTxcfzzDMl/0NPjorWcnhTQkxRScOhrcFxgJ9SQip74r3181VIk6xyWINnisZYq6NWDXVBdIPwfWwjrEVGBeYm0z+QVb56RdNGcOVwoNqIUqJj29ghOzDujhWOhn8UgC80gxSu/yxnOGsVDi3aZY2tVxoy5XtxjioHAvAcLb6Xgv/ml2+0OD/nLH6v7eua4cbkG6zRZBFMlUaRwlU4uScCQgcVttqhLAe4mIM2+YBXLN2TC6X5fDPJdFhRggWGnRgU1xCG8DQmbglCgIJPnJiQw988KrSvERvfd+UMF0kV1aVEiCLNUJEhUIrrjIifVEfCLOtg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=efficios.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=x05E2GcqncoaU1anPZCs+KyGiP1VouRf3Jk5LHe6XOk=; b=40DeZozAl4XQR5Of0iPC8J6YGB6nivhSm0YV1k0xFBKtsfsiufpht2Sj1EBOrZCk8WDBRcMup/GEZSh0S8gQ1bjmeJWllSXtSDCl7uUL6ikcwNDdH6rzCzCF0GYzZNMtjBdyCpsnn7XmPHONN+ze6b3yKfCYC75jAeAEe9rK0ow= Received: from MN0PR04CA0016.namprd04.prod.outlook.com (2603:10b6:208:52d::8) by IA1PR12MB7736.namprd12.prod.outlook.com (2603:10b6:208:420::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8792.33; Fri, 6 Jun 2025 11:00:30 +0000 Received: from BL02EPF0001A106.namprd05.prod.outlook.com (2603:10b6:208:52d:cafe::ca) by MN0PR04CA0016.outlook.office365.com (2603:10b6:208:52d::8) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.8792.22 via Frontend Transport; Fri, 6 Jun 2025 11:00:29 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL02EPF0001A106.mail.protection.outlook.com (10.167.241.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8792.29 via Frontend Transport; Fri, 6 Jun 2025 11:00:29 +0000 Received: from khazad-dum (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 6 Jun 2025 06:00:28 -0500 Date: Fri, 6 Jun 2025 12:00:19 +0100 From: Lancelot SIX To: Simon Marchi CC: Subject: Re: [PATCH 3/5] gdb/amd-dbgapi: pass amd_dbgapi_inferior_info to process_event_queue Message-ID: <9e94ce1e-56dd-49d5-ac03-d61c2e3a677f@SATLEXMB04.amd.com> References: <20250605201657.418206-3-simon.marchi@efficios.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20250605201657.418206-3-simon.marchi@efficios.com> X-Originating-IP: [10.180.168.240] X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL02EPF0001A106:EE_|IA1PR12MB7736:EE_ X-MS-Office365-Filtering-Correlation-Id: 20ef12a2-4107-4b9d-f911-08dda4e959ad X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|1800799024|36860700013; X-Microsoft-Antispam-Message-Info: =?utf-8?B?Sml2RGh2cVFNY2IvRDVkMlJPODZpTTZYNlUzVnR1YUJ4TzFxVzVUbkpBeEFo?= =?utf-8?B?VlgxYno4VHdqZ3BTdUxCZ3RtUVIyVWlyYjdPTFdPelBxQzRtcDd3Z0tsZ1Ft?= =?utf-8?B?emZHbEJsR1hYMnhiTVl0N2hsVzQ3VEdjK0E3bHJxeWF4UmUyRjNzT2drZUdl?= =?utf-8?B?S3RlRW9ueVh1dHlEQmoyNE51cUwzUnBCYWpQWTlLZ0krdFowUUI5ZkpHOUVa?= =?utf-8?B?SnBqKzRiQm4zTGgwV0JyMzdBRUR2ZmNGcDBzd0lLMjdUWHlJc0VCWTNDT2FL?= =?utf-8?B?Sm1sTUgwTWRmOU41ZDNxUUljcDZRK3dERmlKcWxrOU9YTy9hM3RaY25VSzJG?= =?utf-8?B?UkljbVlqSWcxeTI5TVNocG5pSEM5SWh5eGpJam1sZldtSkpBMmlFZ2FCOVRy?= =?utf-8?B?eG9BdHhuN2ltcjVZYUZuZnBiZVdpanFXS0J6RHdl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TNVeXNKcTFVQ3lVR09DRWVzNFJRV0gwRDl3YXNx?= =?utf-8?B?b0MzMCs2MlgwUjdnaWgwRjFMWTZaRGZ0dVJFbVJLR2pUa2pmaWtyTjFObmth?= =?utf-8?B?aVk4RWhGSUticjJvYUVkeGZQTGlxUkdKTStSMENIcVpMTzN3bFZhK0ZMMmVU?= =?utf-8?B?YUVTNWc0eEZxRkhxeXBXSU9ETHRXVm1tWjQzZ3Y3NHZpLzhYdjQ3N1hscllR?= =?utf-8?B?eGlBZ2QxRW0vdTFBNDhXdWNSSXRraFFFaTZaS3V3NFpmbS9qdlUrUGo1c3dn?= =?utf-8?B?MDBieFpJZ2I0bklEQmxpb1VQWjUwNnBWZ0ptRnpSd09CMnIwUWFTNXpZMmlS?= =?utf-8?B?UUtNQzA5Vm44dWsvNEh3ZjZ6UHlPWllBbnRtTlQ4TEtxYmMvSmltSDlPTko1?= =?utf-8?B?THB2UkpMT2pTWThacjFhaXRsWEpIRVpLcFNrNjZCdWNSS3ZrSkwxUmNyc0xT?= =?utf-8?B?V3RETktGWHdpNmhUMkQ5MUFyVWM0TktyZjI5Ny80UkZnUXplRDVKR3Y5SlNX?= =?utf-8?B?TVR4RG1OelRhLzlVNUJ5eUFHRXlpZ2pMTUZ0MnpXQzA5QnpXZHlkR1FoWVY0?= =?utf-8?B?Q2xVcG0xbHZteFpjVEJISXlnbFg2eGJZVGUvL0R1SkU5MUV5bW9ucnhDanlF?= =?utf-8?B?ak93aEpoRzh6Y3l4LzhSNDZoMWhBcEMrd3NtN3pVZEdMRWZhdXlIZnIranFm?= =?utf-8?Q?+LGmn5?= X-Forefront-Antispam-Report: CIP:165.204.84.17; CTRY:US; LANG:en; SCL:1; SRV:; IPV:CAL; SFV:NSPM; H:SATLEXMB04.amd.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(376014)(1800799024)(36860700013); DIR:OUT; SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Jun 2025 11:00:29.4955 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 20ef12a2-4107-4b9d-f911-08dda4e959ad X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL02EPF0001A106.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR12MB7736 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On Thu, Jun 05, 2025 at 04:16:26PM -0400, Simon Marchi wrote: > A following patch will make process_event_queue access a field of > amd_dbgapi_inferior_info. Prepare for this by making > process_event_queue accept an amd_dbgapi_inferior_info object, instead > of a process id. > > Change-Id: I9adc491dd1ff64ff74c40aa7662fffb11bd8332b > --- > gdb/amd-dbgapi-target.c | 25 +++++++++---------------- > 1 file changed, 9 insertions(+), 16 deletions(-) > > diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c > index 8fd8bcf5ae49..1ec20d1874ec 100644 > --- a/gdb/amd-dbgapi-target.c > +++ b/gdb/amd-dbgapi-target.c > @@ -234,7 +234,7 @@ struct amd_dbgapi_inferior_info > }; > > static amd_dbgapi_event_id_t process_event_queue > - (amd_dbgapi_process_id_t process_id, > + (amd_dbgapi_inferior_info &info, > amd_dbgapi_event_kind_t until_event_kind = AMD_DBGAPI_EVENT_KIND_NONE); > > static const target_info amd_dbgapi_target_info = { > @@ -564,8 +564,7 @@ amd_dbgapi_target_breakpoint::check_status (struct bpstat *bs) > /* If the action is AMD_DBGAPI_BREAKPOINT_ACTION_HALT, we need to wait until > a breakpoint resume event for this breakpoint_id is seen. */ > amd_dbgapi_event_id_t resume_event_id > - = process_event_queue (info->process_id, > - AMD_DBGAPI_EVENT_KIND_BREAKPOINT_RESUME); > + = process_event_queue (*info, AMD_DBGAPI_EVENT_KIND_BREAKPOINT_RESUME); > > /* We should always get a breakpoint_resume event after processing all > events generated by reporting the breakpoint hit. */ > @@ -1337,28 +1336,22 @@ event_kind_str (amd_dbgapi_event_kind_t kind) > gdb_assert_not_reached ("unhandled amd_dbgapi_event_kind_t value"); > } > > -/* Drain the dbgapi event queue of a given process_id, or of all processes if > - process_id is AMD_DBGAPI_PROCESS_NONE. Stop processing the events if an > - event of a given kind is requested and `process_id` is not > - AMD_DBGAPI_PROCESS_NONE. Wave stop events that are not returned are queued > - into their inferior's amd_dbgapi_inferior_info pending wave events. */ > +/* Drain the dbgapi event queue of a given process_id. Stop processing the It reads odd to have process_id here, as we don't pass it as an explicit parameter anymore. Could it say "a given inferior" instead? > + events if an event of a given kind is requested (not AMD_DBGAPI_EVENT_NONE). > + Wave stop events that are not returned are queued into their inferior's > + amd_dbgapi_inferior_info pending wave events. */ My first intuition when reading this patch was "hey, the INFO param is never modified, why not use a const ref". But eventually ,under process_one_event, we'll grab a reference to the INFO and modify it to stash stop events. Should this patch go one step further, and have the INFO passed to process_one_event (this one can ensure the event's process_id matches the INFO's process_id)? This would also save iterating over all inferiors to find the one we are looking for. Best, Lancelot. > > static amd_dbgapi_event_id_t > -process_event_queue (amd_dbgapi_process_id_t process_id, > +process_event_queue (amd_dbgapi_inferior_info &info, > amd_dbgapi_event_kind_t until_event_kind) > { > - /* An event of a given type can only be requested from a single > - process_id. */ > - gdb_assert (until_event_kind == AMD_DBGAPI_EVENT_KIND_NONE > - || process_id != AMD_DBGAPI_PROCESS_NONE); > - > while (true) > { > amd_dbgapi_event_id_t event_id; > amd_dbgapi_event_kind_t event_kind; > > amd_dbgapi_status_t status > - = amd_dbgapi_process_next_pending_event (process_id, &event_id, > + = amd_dbgapi_process_next_pending_event (info.process_id, &event_id, > &event_kind); > > if (status != AMD_DBGAPI_STATUS_SUCCESS) > @@ -1479,7 +1472,7 @@ amd_dbgapi_target::wait (ptid_t ptid, struct target_waitstatus *ws, > /* Drain the events for the current inferior from the amd_dbgapi and > preserve the ordering. */ > auto info = get_amd_dbgapi_inferior_info (current_inferior ()); > - process_event_queue (info->process_id); > + process_event_queue (*info); > > std::tie (event_ptid, gpu_waitstatus) = consume_one_event (ptid.pid ()); > if (event_ptid == minus_one_ptid) > -- > 2.49.0