From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id qSZrFoSIDWoUDwoAWB0awg (envelope-from ) for ; Wed, 20 May 2026 06:10:12 -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=nthzVuCp; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 4E3091E098; Wed, 20 May 2026 06:10:12 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-3.4 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_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (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 1C0621E062 for ; Wed, 20 May 2026 06:10:11 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id C2AC64BB8F44 for ; Wed, 20 May 2026 10:10:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C2AC64BB8F44 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=nthzVuCp Received: from MW6PR02CU001.outbound.protection.outlook.com (mail-westus2azon11012008.outbound.protection.outlook.com [52.101.48.8]) by sourceware.org (Postfix) with ESMTPS id AD3CF4B920A5 for ; Wed, 20 May 2026 10:09:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org AD3CF4B920A5 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 AD3CF4B920A5 Authentication-Results: sourceware.org; arc=fail smtp.remote-ip=52.101.48.8 ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1779271782; cv=fail; b=O6oCDxSrlDIHjloRyCLHSqfej3kjEQViJUNwxFE0ggGuz0tzBijLiAlC/9+wyj3spYcc5DBIEARg7RIrG5FjcBVsSdjoG/Xbqvr02OE+BuKX7aPsG/PyAenM0X7sx0RWoG6sQoZgHiQ3GXqVp+0TZa7OurLPIoQ3zU+DMydMY8c= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1779271782; c=relaxed/simple; bh=xqTXS2N+GMpnul+t1pnXX+0PRu0O2363qJrOJHW31uk=; h=DKIM-Signature:Message-ID:Date:Subject:To:From:MIME-Version; b=mF9tiuvOhyMjczFOZXx8Z3bfaYsNLxNS//gDSMD5lKqoDmMybCbRBKWFLxRagp1PG1Aq48/A7k0NH3lkJO2DH6GikGK4BwybStP3J1zrdnBuRCpPitf6VNAflU39qWuFENgbLZrZP/9fA2f5+WriMR+TBDX/gWIWXtx0kDfr2Ak= ARC-Authentication-Results: i=2; 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=nthzVuCp DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AD3CF4B920A5 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WgcJD5w36zmVptaW6WRR4UQQWavZa8Q7aX8Gop7g5jnRwcCqhHsRylm8zcdFLwrAeY5Eq5sg40eOEC93pOBeOFUVPMgpU9YM15rEjHJHL4C83xHmxbCqFMNyUctoW6i7OqbHY3j3qGfEAvrk1luoyF7wqeKf8qneUdz3wiYG3Pct09BoQQ8uWQVxDiYwnHQP9wKgRmZICrUCq9niUw1DenQGNgASX7vfai5nbFA2YrFLz/mVHh5JZXKUfFi7OAW/qGAc+OhzBXKDQtYzuKUEMxwMCENuHLnit25nID4JtqDDto6/lQQOvd+iXaWhoD6oBrH0/7xuH5ciTwEkYd6yLg== 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=ZDe7MBC06aZW0diLj2h3FfDgTSJ8CHAfnzCKOWLIhdA=; b=G5VwR9b3FNmGZ5VmQbxguiwy8gSxBXAyWDnVB3j1xpjvoFYbqtwJ8xIctZFK9atRqX/5RqzNULRw+Y9cArxMjs+G2WXmDVA4jzQMyLlNHqaulvkN11vJqxeyXz5P/FkTrL9+rfmE/GBhl4J2NYgwBka2jtoh+bjWWA5xoEBDOJGodlCBR321TXXGTTI/Q/bPeZahC4RkiKvvDPYz8v40hhdTOYHvBWh+c0wO00LgXj2MJ8ZoRGtLGTQCh7d17il2IbCYr2bOAScU01XD5b3D8dunyu56XjtshMIEw6wv8xQGuhDmv0yJh4bNmNeJgzsY6aZDyzkvNhPFfsnr7lMspA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none 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=ZDe7MBC06aZW0diLj2h3FfDgTSJ8CHAfnzCKOWLIhdA=; b=nthzVuCprkIlNqSrOtGO+hgOkq+GBufX7FPk0p8tMm/P+mboKwVlXBV7q6FkYmXIJl9hCb5G5Qmp6/KGCLiY1oFBOFjkRGjojZm7copSvD+Z/aAgXQ2SagjZaOLs3b815StvmXBpS6XePtxLxP9oJ1aeuGeSOtXszcgL1+tj+ws= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH3PR12MB9079.namprd12.prod.outlook.com (2603:10b6:610:1a1::9) by DM4PR12MB6613.namprd12.prod.outlook.com (2603:10b6:8:b8::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.48.14; Wed, 20 May 2026 10:09:37 +0000 Received: from CH3PR12MB9079.namprd12.prod.outlook.com ([fe80::5a7a:2adf:1862:35c3]) by CH3PR12MB9079.namprd12.prod.outlook.com ([fe80::5a7a:2adf:1862:35c3%5]) with mapi id 15.21.0048.016; Wed, 20 May 2026 10:09:37 +0000 Message-ID: Date: Wed, 20 May 2026 11:09:33 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] gdb/amd-dbgapi-target: suppress a repeated stop request To: Tankut Baris Aktemur , gdb-patches@sourceware.org References: <20260520085820.1299345-1-tankutbaris.aktemur@amd.com> Content-Language: en-US From: Lancelot SIX In-Reply-To: <20260520085820.1299345-1-tankutbaris.aktemur@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FRYP281CA0001.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10::11) To CH3PR12MB9079.namprd12.prod.outlook.com (2603:10b6:610:1a1::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH3PR12MB9079:EE_|DM4PR12MB6613:EE_ X-MS-Office365-Filtering-Correlation-Id: 112d136e-02e0-4fd4-8588-08deb657e619 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|366016|13003099007|5023799004|11063799006|3023799007|18002099003|56012099003|22082099003; X-Microsoft-Antispam-Message-Info: dkdWaLAoJp6tEOlk0ouA8kIXW2yYNuSC/WXYqQ9ns0OroVcG//uYZrhQXw97v0p5KKPZc9pi4A1PHH/SVhk0JxgNxh6SAIFctgESYdxibsTMMnmcYPJUW3LhIE6i6QPAwao3U4Isj4sivZLscWjCkLCzDS6fQAp19ynnF5KaM3M40Axm/AHtSLTGGp2VD9kkA+49eIFCjgd7U8Gmg45s9JM05AID+cUtEXrSg6D5xRK7mxMG3X4kcgFGUDnNWYTH+Ge73bTAmbxBhHPAziMMW8v5snVbCwe3MlBnXKnsZ4xQ9jWW2dwFVIIztouLKf0xpj3T+GIrsCmuzAmplgq6oEQFIPHZrqc7ym8w6ScOki8tGh9EUb6vdFR3latGLmv84V2SEN/DnQOuA9+jb/AmtkSyrf98kVJrZDxptaFlgOCLmI5+eUDxInuFnNRl34AvpbKvpkBwo7yDjLL+k/0Q72JS9LKrOJQSZ54BL9El34vWbmVCRNNgxfmOALRD/I+Ehc6Xa1HRUXI3SVH+JDRVwpBePZlF8wNHDFJgorSqAY+JQfFYKq3dzXvsPh098XbdN7AwNyMK/Z8cisQM93339IA9BuOEzG39sa2MGoJTn35VAuYlh8BpGxAMbdEZaY0w0pcWUXQkDjc9B9kkGno8JG1fA7iqAuDuNpdrcIkeVhES7WzKcuWhuYyE/DMdKEmtpLq51Eiq6g0uXIUboQ6hug== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH3PR12MB9079.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(376014)(366016)(13003099007)(5023799004)(11063799006)(3023799007)(18002099003)(56012099003)(22082099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?S1hvemxUNExkd1hQUHhR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nR2ZBREdD?= =?utf-8?B?b1JWTW9zMGhGbUlqL004dXVwQTlpc281OVp2ZndhT3oreWpMc25TZ1AzM0ND?= =?utf-8?B?K0FMek5zdDRxRU8valNUTEZxNW8zVmNrcWJrSUR6blhwUHVtWUhTM0FacXdB?= =?utf-8?B?aG5HYWNDOERRRGxMNUJtR1ovMk1uTlhBQ3ZwKzhvSHJhUFlRY3Y0Y0hrcFVQ?= =?utf-8?B?enp1YjhLSDZ3WXlrYmZDajFLSGRNQW5XTjVWYitPckcxV1U0aFE4NHJRRzEr?= =?utf-8?B?M1I3R1NUK3RkSXBqMFNwakloeVlRaWc4SmsvT0pzRklXemt5UWZONC9UQ0Jw?= =?utf-8?B?NXFnb2xGMWVmcjZXNE8rd3dxVHJaQm1DM2JNVUtxcFpwOUpBVXhYTThJY2dP?= =?utf-8?B?S3M0S3A0b2o4ekJQMkhYOUJ5TGVUTktrZzZoZEFxS3Y5NFNYMnlrVUJnREFi?= =?utf-8?B?eVBZZ3BobDF2WHdIdUhYQ2d6elNmUVAyaFpqS1NUUDJFNHU2b0c4bzdEQTRF?= =?utf-8?Q?6iiCsR5wJga09HJFqt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 112d136e-02e0-4fd4-8588-08deb657e619 X-MS-Exchange-CrossTenant-AuthSource: CH3PR12MB9079.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 May 2026 10:09:37.3958 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dHsWjvTomn7Do4tMjP820GCO1TM4WUtxWLGx8qH+DDqmvN1EjnUFpX3zwRyfFe/Xnk5A9MdiyAcoqeOvKN6Kxg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6613 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 Hi, On 20/05/2026 09:58, Tankut Baris Aktemur wrote: > Sending a second stop request to an AMD GPU thread before fetching the > event caused by the first request leads to an error: > > wave_stop for wave_1 failed (The wave has an outstanding stop request) > > Prevent sending a new stop request if there already is an outstanding > one. The fix is in amd_dbgapi_target::stop. > > A regression test is included. The test uses non-stop mode and > executes the "interrupt" command twice, because in non-stop mode this > command uses the 'stop' target op, where the fix is applied. > > To be able to execute two interrupt commands repeatedly, we define a > user command. > --- > gdb/amd-dbgapi-target.c | 8 ++- > gdb/testsuite/gdb.rocm/interrupt-twice.cpp | 43 ++++++++++++ > gdb/testsuite/gdb.rocm/interrupt-twice.exp | 82 ++++++++++++++++++++++ > 3 files changed, 130 insertions(+), 3 deletions(-) > create mode 100644 gdb/testsuite/gdb.rocm/interrupt-twice.cpp > create mode 100644 gdb/testsuite/gdb.rocm/interrupt-twice.exp > > diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c > index 421ec8599ed..d44f03d0b80 100644 > --- a/gdb/amd-dbgapi-target.c > +++ b/gdb/amd-dbgapi-target.c > @@ -1090,14 +1090,16 @@ amd_dbgapi_target::stop (ptid_t ptid) > sizeof (state), &state); > if (status == AMD_DBGAPI_STATUS_SUCCESS) > { > - /* If the wave is already known to be stopped then do nothing. */ > - if (state == AMD_DBGAPI_WAVE_STATE_STOP) > + wave_info &wi = get_thread_wave_info (thread); > + > + /* If the wave is already known to be stopped or there is an > + outstanding stop request, then do nothing. */ > + if (state == AMD_DBGAPI_WAVE_STATE_STOP || wi.stopping) > return; > > status = amd_dbgapi_wave_stop (wave_id); > if (status == AMD_DBGAPI_STATUS_SUCCESS) > { > - wave_info &wi = get_thread_wave_info (thread); > wi.stopping = true; > return; > } > diff --git a/gdb/testsuite/gdb.rocm/interrupt-twice.cpp b/gdb/testsuite/gdb.rocm/interrupt-twice.cpp > new file mode 100644 > index 00000000000..fc8d2cca697 > --- /dev/null > +++ b/gdb/testsuite/gdb.rocm/interrupt-twice.cpp > @@ -0,0 +1,43 @@ > +/* Copyright 2026 Free Software Foundation, Inc. > + > + This file is part of GDB. > + > + This program is free software; you can redistribute it and/or modify > + it under the terms of the GNU General Public License as published by > + the Free Software Foundation; either version 3 of the License, or > + (at your option) any later version. > + > + This program is distributed in the hope that it will be useful, > + but WITHOUT ANY WARRANTY; without even the implied warranty of > + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > + GNU General Public License for more details. > + > + You should have received a copy of the GNU General Public License > + along with this program. If not, see . */ > + > +#include > +#include "gdb_watchdog.h" > + > +__device__ void > +loop () > +{ > + while (true) > + __builtin_amdgcn_s_sleep (8); > +} > + > +__global__ void > +kern () > +{ > + loop (); > +} > + > +int > +main () > +{ > + /* Make sure that if anything goes wrong, the program eventually > + gets killed. */ > + gdb_watchdog (30); > + > + kern<<<1, 1>>> (); > + return hipDeviceSynchronize () != hipSuccess; > +} > diff --git a/gdb/testsuite/gdb.rocm/interrupt-twice.exp b/gdb/testsuite/gdb.rocm/interrupt-twice.exp > new file mode 100644 > index 00000000000..681efab0af3 > --- /dev/null > +++ b/gdb/testsuite/gdb.rocm/interrupt-twice.exp > @@ -0,0 +1,82 @@ > +# Copyright 2026 Free Software Foundation, Inc. > + > +# This program is free software; you can redistribute it and/or modify > +# it under the terms of the GNU General Public License as published by > +# the Free Software Foundation; either version 3 of the License, or > +# (at your option) any later version. > +# > +# This program is distributed in the hope that it will be useful, > +# but WITHOUT ANY WARRANTY; without even the implied warranty of > +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +# GNU General Public License for more details. > +# > +# You should have received a copy of the GNU General Public License > +# along with this program. If not, see . > + > +# Test that sending repeated stop requests to a running GPU thread > +# does not cause a failure. This is done in non-stop mode because > +# "interrupt" command in this mode uses the 'stop' target op. > + > +load_lib rocm.exp > + > +require allow_hipcc_tests > + > +standard_testfile .cpp > + > +if {[build_executable "failed to prepare" $testfile $srcfile {debug hip}]} { > + return > +} > + > +with_rocm_gpu_lock { > + save_vars { ::GDBFLAGS } { > + append ::GDBFLAGS " -ex \"set non-stop on\"" > + clean_restart $::testfile > + } > + > + gdb_breakpoint "loop" {allow-pending} {temporary} > + gdb_run_cmd > + > + set gpu_thread "undefined" > + > + gdb_test_multiple "" "hit breakpoint" { > + -re -wrap "Thread ($decimal) \[^\r\n\]*hit Temporary breakpoint.*" { > + set gpu_thread $expect_out(1,string) > + pass $gdb_test_name > + } > + } > + > + gdb_test "thread $gpu_thread" "Switching to.*" "switch to gpu thread" > + > + # Resume the thread in the background. It will loop. Then we > + # interrupt twice. To be able to run the "interrupt" command back > + # to back, we define a user command. > + gdb_test "continue &" "Continuing." "continue async" > + > + gdb_test_multiple "define inttwice" "" { > + -re "End with .*>$" { > + pass $gdb_test_name > + } > + } > + > + gdb_test [multi_line_input \ > + {interrupt} \ > + {interrupt} \ > + {end}] \ > + "" \ > + "enter commands" Having 2 tests here seems odd. There should be just one PASS/FAIL for the entire command. There are 2 approaches to do this. First, gdb_test has all the machinery in place to do the "question - response" interaction: gdb_test \ "define inttwice" \ "" \ "define inttwice" \ "Type commands for definition of \"inttwice\"\.\r\nEnd with a line saying just \"end\"\.\r\n>" \ [multi_line_input "interrupt" "interrupt" "end"] The second approach is to use gdb_test_multiple all the way, and use send_gdb to reply to the question gdb_test_multiple "define inttwice" "" { -re "Type commands for definition of \"inttwice\"\.\r\nEnd with a line saying just \"end\"\.\r\n>$" { send_gdb [multi_line_input "interrupt" "interrupt" "end" ""] exp_continue } -re "$::gdb_prompt $" { pass $gdb_test_name } } The rest looks reasonable to me. Best, Lancelot. > + > + # For logging purposes. > + gdb_test "show user inttwice" > + > + gdb_test_multiple "inttwice" "interrupt twice" { > + -re "wave_stop \[^\r\n\]+ failed \[^\r\n\]+ outstanding stop request\\)\r\n" { > + fail $gdb_test_name > + } > + -re "Thread $gpu_thread \[^\r\n\]*stopped" { > + pass $gdb_test_name > + } > + -re "$gdb_prompt" { > + exp_continue > + } > + } > +}