Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX <lancelot.six@amd.com>
To: Simon Marchi <simon.marchi@efficios.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 4/5] gdb/amd-dbgapi: factor out require_forward_progress overload to target one inferior
Date: Fri, 6 Jun 2025 14:36:53 +0100	[thread overview]
Message-ID: <lgsk2e6h2w23pavoxtnqezifo7oheywvi3zpuvkm2hkcioaird@kd4uo6ivmkzk> (raw)
In-Reply-To: <20250605201657.418206-4-simon.marchi@efficios.com>

On Thu, Jun 05, 2025 at 04:16:27PM -0400, Simon Marchi wrote:
> A following patch will want to call require_forward_progress for a given
> inferior.  Extract a new require_forward_progress overload from the
> existing require_forward_progress function that targets a specific
> inferior.

Hi,

This LGTM, thanks.

Approved-by: Lancelot Six <lancelot.six@amd.com> (amdgpu)

Best,
Lancelot.

> 
> Change-Id: I54f42b83eb8443d4d91747ffbc86eaeb017f1e49
> ---
>  gdb/amd-dbgapi-target.c | 49 +++++++++++++++++++++++------------------
>  1 file changed, 28 insertions(+), 21 deletions(-)
> 
> diff --git a/gdb/amd-dbgapi-target.c b/gdb/amd-dbgapi-target.c
> index 1ec20d1874ec..e86d7f34d0f6 100644
> --- a/gdb/amd-dbgapi-target.c
> +++ b/gdb/amd-dbgapi-target.c
> @@ -443,6 +443,32 @@ async_event_handler_mark ()
>    mark_async_event_handler (amd_dbgapi_async_event_handler);
>  }
>  
> +/* Set forward progress requirement to REQUIRE for inferior INFO.  */
> +
> +static void
> +require_forward_progress (amd_dbgapi_inferior_info &info, bool require)
> +{
> +  /* If we try to disable forward progress requirement but the target expects
> +     resumed threads to be committed to the target, we could wait for events
> +     that will never arrive.  */
> +  if (!require)
> +    gdb_assert (!info.inf->process_target ()->commit_resumed_state);
> +
> +  gdb_assert (info.process_id != AMD_DBGAPI_PROCESS_NONE);
> +
> +  /* Don't do unnecessary calls to amd-dbgapi to avoid polluting the logs.  */
> +  if (info.forward_progress_required == require)
> +    return;
> +
> +  const auto progress
> +    = require ? AMD_DBGAPI_PROGRESS_NORMAL : AMD_DBGAPI_PROGRESS_NO_FORWARD;
> +  const auto status
> +    = amd_dbgapi_process_set_progress (info.process_id, progress);
> +  gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS);
> +
> +  info.forward_progress_required = require;
> +}
> +
>  /* Set forward progress requirement to REQUIRE for all processes of PROC_TARGET
>     matching PTID.  */
>  
> @@ -450,12 +476,6 @@ static void
>  require_forward_progress (ptid_t ptid, process_stratum_target *proc_target,
>  			  bool require)
>  {
> -  /* If we try to disable forward progress requirement but the target expects
> -     resumed threads to be committed to the target, we could wait for events
> -     that will never arrive.  */
> -  if (!require)
> -    gdb_assert (!proc_target->commit_resumed_state);
> -
>    for (inferior *inf : all_inferiors (proc_target))
>      {
>        if (ptid != minus_one_ptid && inf->pid != ptid.pid ())
> @@ -463,21 +483,8 @@ require_forward_progress (ptid_t ptid, process_stratum_target *proc_target,
>  
>        amd_dbgapi_inferior_info *info = get_amd_dbgapi_inferior_info (inf);
>  
> -      if (info->process_id == AMD_DBGAPI_PROCESS_NONE)
> -	continue;
> -
> -      /* Don't do unnecessary calls to amd-dbgapi to avoid polluting the logs.  */
> -      if (info->forward_progress_required == require)
> -	continue;
> -
> -      amd_dbgapi_status_t status
> -	= amd_dbgapi_process_set_progress
> -	    (info->process_id, (require
> -				? AMD_DBGAPI_PROGRESS_NORMAL
> -				: AMD_DBGAPI_PROGRESS_NO_FORWARD));
> -      gdb_assert (status == AMD_DBGAPI_STATUS_SUCCESS);
> -
> -      info->forward_progress_required = require;
> +      if (info->process_id != AMD_DBGAPI_PROCESS_NONE)
> +	require_forward_progress (*info, require);
>  
>        /* If ptid targets a single inferior and we have found it, no need to
>  	 continue.  */
> -- 
> 2.49.0

  reply	other threads:[~2025-06-06 13:37 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-05 20:16 [PATCH 1/5] gdb/amd-dbgapi: remove unnecessary AMD_DBGAPI_EVENT_KIND_NONE argument Simon Marchi
2025-06-05 20:16 ` [PATCH 2/5] gdb/amd-dbgapi: add assert in require_forward_progress Simon Marchi
2025-06-06 10:06   ` Lancelot SIX
2025-06-05 20:16 ` [PATCH 3/5] gdb/amd-dbgapi: pass amd_dbgapi_inferior_info to process_event_queue Simon Marchi
2025-06-06 11:00   ` Lancelot SIX
2025-06-09 15:36     ` Simon Marchi
2025-06-05 20:16 ` [PATCH 4/5] gdb/amd-dbgapi: factor out require_forward_progress overload to target one inferior Simon Marchi
2025-06-06 13:36   ` Lancelot SIX [this message]
2025-06-05 20:16 ` [PATCH 5/5] gdb/amd-dbgapi: disable forward progress requirement in amd_dbgapi_target_breakpoint::check_status Simon Marchi
2025-06-06 13:58   ` Lancelot SIX
2025-06-09 15:59     ` Simon Marchi
2025-06-06  9:59 ` [PATCH 1/5] gdb/amd-dbgapi: remove unnecessary AMD_DBGAPI_EVENT_KIND_NONE argument Lancelot SIX

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=lgsk2e6h2w23pavoxtnqezifo7oheywvi3zpuvkm2hkcioaird@kd4uo6ivmkzk \
    --to=lancelot.six@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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