mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Zecheng Li <zecheng@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Jiri Olsa <jolsa@kernel.org>, Ian Rogers <irogers@google.com>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"Liang, Kan" <kan.liang@linux.intel.com>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Xu Liu <xliuprof@google.com>,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 09/10] perf dwarf-aux: fix __die_find_scope_cb for namespaces
Date: Sat, 30 Aug 2025 00:32:19 -0700	[thread overview]
Message-ID: <aLKpAxq5QQIwD_Z_@google.com> (raw)
In-Reply-To: <20250825195817.226560-1-zecheng@google.com>

On Mon, Aug 25, 2025 at 07:58:17PM +0000, Zecheng Li wrote:
> Currently __die_find_scope_cb goes to check siblings when the DIE
> doesn't include the given PC. However namespaces don't have a PC and
> could contain children that have that PC. When we encounter a namespace,
> we should check both its children and siblings.
> 
> Signed-off-by: Zecheng Li <zecheng@google.com>

Reviewed-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

> ---
>  tools/perf/util/dwarf-aux.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/tools/perf/util/dwarf-aux.c b/tools/perf/util/dwarf-aux.c
> index 56e1b5690dc4..013862ea8924 100644
> --- a/tools/perf/util/dwarf-aux.c
> +++ b/tools/perf/util/dwarf-aux.c
> @@ -1962,6 +1962,7 @@ struct find_scope_data {
>  static int __die_find_scope_cb(Dwarf_Die *die_mem, void *arg)
>  {
>  	struct find_scope_data *data = arg;
> +	int tag = dwarf_tag(die_mem);
>  
>  	if (dwarf_haspc(die_mem, data->pc)) {
>  		Dwarf_Die *tmp;
> @@ -1975,6 +1976,14 @@ static int __die_find_scope_cb(Dwarf_Die *die_mem, void *arg)
>  		data->nr++;
>  		return DIE_FIND_CB_CHILD;
>  	}
> +
> +	/*
> +	 * If the DIE doesn't have the PC, we still need to check its children
> +	 * and siblings if it's a container like a namespace.
> +	 */
> +	if (tag == DW_TAG_namespace)
> +		return DIE_FIND_CB_CONTINUE;
> +
>  	return DIE_FIND_CB_SIBLING;
>  }
>  
> -- 
> 2.51.0.261.g7ce5a0a67e-goog
> 

  reply	other threads:[~2025-08-30  7:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-25 19:58 Zecheng Li
2025-08-30  7:32 ` Namhyung Kim [this message]
2025-09-13 14:41   ` Arnaldo Carvalho de Melo

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=aLKpAxq5QQIwD_Z_@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=kan.liang@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mhiramat@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=xliuprof@google.com \
    --cc=zecheng@google.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

all inboxes | Powered by JetHome®