mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
	James Clark <james.clark@linaro.org>,
	Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 4/5] perf tools: Use machine->root_dir to find /proc/kallsyms
Date: Tue, 2 Dec 2025 13:26:20 -0800	[thread overview]
Message-ID: <aS9ZfAd3CDh5wboJ@google.com> (raw)
In-Reply-To: <CAP-5=fXWwQjdAQHNxVoz1=AF83g75Yd=L32owxCfyiXKL+mVeA@mail.gmail.com>

On Tue, Dec 02, 2025 at 12:53:48PM -0800, Ian Rogers wrote:
> On Tue, Dec 2, 2025 at 12:16 AM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > This is for test functions to find the kallsyms correctly.  It can find
> > the machine from the kernel maps and use its root_dir.  This is helpful
> > to setup fake /proc directory for testing.
> >
> > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > ---
> >  tools/perf/util/symbol.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
> > index b533fbf17a8b19a3..e90ecfd286043aa4 100644
> > --- a/tools/perf/util/symbol.c
> > +++ b/tools/perf/util/symbol.c
> > @@ -2002,6 +2002,7 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
> >         char sbuild_id[SBUILD_ID_SIZE];
> >         bool is_host = false;
> >         char path[PATH_MAX];
> > +       struct kmap *kmap = map__kmap(map);
> 
> Reviewed-by: Ian Rogers <irogers@google.com>
> 
> nit: perhaps just use map__kmaps here to avoid testing two values below.

Right, will update.  Thanks for your review!
Namhyung
 
> >
> >         if (!dso__has_build_id(dso)) {
> >                 /*
> > @@ -2038,8 +2039,13 @@ static char *dso__find_kallsyms(struct dso *dso, struct map *map)
> >                 return strdup(path);
> >
> >         /* Use current /proc/kallsyms if possible */
> > -       if (is_host) {
> >  proc_kallsyms:
> > +       if (kmap && kmap->kmaps) {
> > +               struct machine *machine = maps__machine(kmap->kmaps);
> > +
> > +               scnprintf(path, sizeof(path), "%s/proc/kallsyms", machine->root_dir);
> > +               return strdup(path);
> > +       } else if (is_host) {
> >                 return strdup("/proc/kallsyms");
> >         }
> >
> > --
> > 2.52.0.158.g65b55ccf14-goog
> >

  reply	other threads:[~2025-12-02 21:26 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-02  8:16 [PATCHSET 0/5] perf tools: Fix /proc/kallsyms map split Namhyung Kim
2025-12-02  8:16 ` [PATCH 1/5] perf tools: Mark split kallsyms DSOs as loaded Namhyung Kim
2025-12-02 20:57   ` Ian Rogers
2025-12-02  8:16 ` [PATCH 2/5] perf tools: Fix split kallsyms DSO counting Namhyung Kim
2025-12-02 20:56   ` Ian Rogers
2025-12-02  8:16 ` [PATCH 3/5] perf tools: Fallback to initial kernel map properly Namhyung Kim
2025-12-02 20:55   ` Ian Rogers
2025-12-02  8:16 ` [PATCH 4/5] perf tools: Use machine->root_dir to find /proc/kallsyms Namhyung Kim
2025-12-02 20:53   ` Ian Rogers
2025-12-02 21:26     ` Namhyung Kim [this message]
2025-12-02  8:16 ` [PATCH 5/5] perf test: Add kallsyms split test Namhyung Kim
2025-12-02 20:46   ` Ian Rogers
2025-12-02 21:31     ` Namhyung Kim

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=aS9ZfAd3CDh5wboJ@google.com \
    --to=namhyung@kernel.org \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=irogers@google.com \
    --cc=james.clark@linaro.org \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /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®