public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simark@simark.ca>
To: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>,
	gdb-patches@sourceware.org
Subject: Re: [PATCH] gdb: iterate over targets, not inferiors, to commit resumed
Date: Fri, 1 Mar 2024 14:02:17 -0500	[thread overview]
Message-ID: <9c467373-6960-42f8-8bfc-a1b94c9df70a@simark.ca> (raw)
In-Reply-To: <20240301155259.1507053-1-tankut.baris.aktemur@intel.com>

On 3/1/24 10:52, Tankut Baris Aktemur wrote:
> When committing resumed threads of targets, iterate over targets, not
> inferiors, so that we don't call commit_resumed multiple times for
> targets that have multiple inferiors.  This gives more concise code.
> 
> Similarly, iterate over targets when setting the commit_resumed_state
> of targets.
> 
> No behavioral change is expected or intended with this patch.

Hi Baris,

The change in maybe_call_commit_resumed_all_targets might not play well
with the amd-dbgapi target (and is probably the reason this code was
written like this in the first place).  Right now, it's kind of a hack,
but the amd-dbgapi target sits on top of the linux-nat target, in the
arch stratum layer.  It intercepts some target calls, and really acts as
a second process target for the inferior, without being an actual
process_stratum_target.

Imagine you have two inferiors, one debugging a plain Linux program and
the other a program using the GPU.  The target stacks will look like:

                  inf1       inf2
    arch stratum: <empty>    amd-dbgapi
 process stratum: linux-nat  linux-nat

By iterating only on process stratum targets, commit_resumed will only
be called on inferior 1, and therefore the amd-dbgapi target will never
see it.  The GPU threads will not effectively be resumed.

Our plan is to try to make amd-dbgapi a proper process_stratum_target
and allow inferiors to have more than one process target, in which case
your change would probably be fine.  We haven't started on that front
yet, unfortunately.

The change in maybe_set_commit_resumed_all_targets is probably fine
though.

Simon

  reply	other threads:[~2024-03-01 19:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-01 15:52 Tankut Baris Aktemur
2024-03-01 19:02 ` Simon Marchi [this message]
2024-03-04  9:28   ` Aktemur, Tankut Baris
2024-03-04 16:34     ` Simon Marchi
2024-03-12 19:05       ` Aktemur, Tankut Baris
2024-03-15 15:06         ` Simon Marchi

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=9c467373-6960-42f8-8bfc-a1b94c9df70a@simark.ca \
    --to=simark@simark.ca \
    --cc=gdb-patches@sourceware.org \
    --cc=tankut.baris.aktemur@intel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).