Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Tankut Baris Aktemur <tankutbaris.aktemur@amd.com>,
	gdb-patches@sourceware.org
Cc: lancelot.six@amd.com, eliz@gnu.org
Subject: Re: [PATCH v2] gdb/amd-dbgapi-target: implement the 'interrupt' target op
Date: Tue, 12 May 2026 19:24:54 +0100	[thread overview]
Message-ID: <51925086-b88a-48a4-bbca-836cbe44039c@palves.net> (raw)
In-Reply-To: <20260512173318.2727821-1-tankutbaris.aktemur@amd.com>

Hi!

On 2026-05-12 18:33, Tankut Baris Aktemur wrote:

>  
> +void
> +amd_dbgapi_target::interrupt ()
> +{
> +  stop (minus_one_ptid);
> +}

Two issues here:

#1 - Note that this changes the behavior of the CPU target.  

We push the dbgapi target on the stack even before GPU debugging is active.  

Before the patch, "interrupt" stops with SIGINT.

After the patch, "interrupt" stops with SIGINT vs "stopped" depending on whether
dbgapi is built into GDB and active, or not.

Ultimately, I want to make the linux target interrupt with "stopped" too, and my
larger "ctrl-c rework" series does that:
  https://inbox.sourceware.org/gdb-patches/20210603190243.2609886-17-pedro@palves.net/

but maybe we can have a simpler localized patch in linux-nat.c meanwhile, similar to
what I did for Windows recently, here:
  https://inbox.sourceware.org/gdb-patches/20260505122434.1444507-1-pedro@palves.net/


#2 - That is going to iterate over all threads and queue a stop for every thread.  That is
incorrect in all-stop mode.  The assumption is that there is only one single event queued,
and then infrun stops all threads when it handles the event.

E.g., if I try without scheduler-locking, I see:

(gdb) c&
Continuing.
(gdb) info threads
  Id   Target Id                                             Frame 
  1    Thread 0x7ffff62a8540 (LWP 3244715) "interrupt-singl" (running)
  2    Thread 0x7fffe8dff6c0 (LWP 3244828) "interrupt-singl" (running)
  3    Thread 0x7fffe3fff6c0 (LWP 3244829) "interrupt-singl" (running)
  6    Thread 0x7ffff5adf6c0 (LWP 3244832) "interrupt-singl" (running)
* 7    AMDGPU Wave 1:2:1:1 (0,0,0)/0 "kern"                  (running)
(gdb) interrupt 
(gdb) ❌️ wave_stop for wave_1 failed (The wave has an outstanding stop request)
(gdb) ❌️ wave_stop for wave_1 failed (The wave has an outstanding stop request)
(gdb) ❌️ wave_stop for wave_1 failed (The wave has an outstanding stop request)
(gdb) ❌️ wave_stop for wave_1 failed (The wave has an outstanding stop request)
(gdb) 
Thread 7 "kern" stopped.
0x00007ffff7fa7d60 in loop () at /home/pedro/rocm/gdb/build/gdb/testsuite/../../../src/gdb/testsuite/gdb.rocm/interrupt-single.cpp:25
25          __builtin_amdgcn_s_sleep (8);


It's probably also possible to trigger badness in the CPU side.

Your test should definitely cover this, not just schedlock on.

Pedro Alves


      parent reply	other threads:[~2026-05-12 18:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-12 17:33 Tankut Baris Aktemur
2026-05-12 18:03 ` Eli Zaretskii
2026-05-13  5:38   ` Aktemur, Baris
2026-05-13 11:21     ` Eli Zaretskii
2026-05-12 18:24 ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51925086-b88a-48a4-bbca-836cbe44039c@palves.net \
    --to=pedro@palves.net \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=lancelot.six@amd.com \
    --cc=tankutbaris.aktemur@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox