From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Ian Rogers <irogers@google.com>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v2 1/2] perf tools: Honor namespace when synthesizing build-id
Date: Wed, 21 Sep 2022 14:49:08 +0100 [thread overview]
Message-ID: <YysWVB724LBSFhII@kernel.org> (raw)
In-Reply-To: <20220920222822.2171056-1-namhyung@kernel.org>
Em Tue, Sep 20, 2022 at 03:28:21PM -0700, Namhyung Kim escreveu:
> It needs to go into a namespace before reading a file.
>
> Fixes: 4183a8d70a28 ("perf tools: Allow synthesizing the build id for kernel/modules/tasks in PERF_RECORD_MMAP2")
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Thanks, applied to perf/urgent.
- Arnaldo
> ---
> tools/perf/util/synthetic-events.c | 17 ++++++++++++++---
> 1 file changed, 14 insertions(+), 3 deletions(-)
>
> diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
> index 0ff57ca24577..289ea17ac5f7 100644
> --- a/tools/perf/util/synthetic-events.c
> +++ b/tools/perf/util/synthetic-events.c
> @@ -367,13 +367,24 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
> bool is_kernel)
> {
> struct build_id bid;
> + struct nsinfo *nsi;
> + struct nscookie nc;
> int rc;
>
> - if (is_kernel)
> + if (is_kernel) {
> rc = sysfs__read_build_id("/sys/kernel/notes", &bid);
> - else
> - rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
> + goto out;
> + }
> +
> + nsi = nsinfo__new(event->pid);
> + nsinfo__mountns_enter(nsi, &nc);
>
> + rc = filename__read_build_id(event->filename, &bid) > 0 ? 0 : -1;
> +
> + nsinfo__mountns_exit(&nc);
> + nsinfo__put(nsi);
> +
> +out:
> if (rc == 0) {
> memcpy(event->build_id, bid.data, sizeof(bid.data));
> event->build_id_size = (u8) bid.size;
> --
> 2.37.3.968.ga6b4b080e4-goog
--
- Arnaldo
prev parent reply other threads:[~2022-09-21 13:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-20 22:28 [PATCH v2 1/2] perf tools: Honor namespace when synthesizing build-id Namhyung Kim
2022-09-20 22:28 ` [PATCH v2 2/2] perf record: Save DSO build-ID for synthesizing Namhyung Kim
2022-09-21 13:50 ` Arnaldo Carvalho de Melo
2022-09-21 17:55 ` Namhyung Kim
2022-10-05 17:50 ` Namhyung Kim
2022-10-05 18:24 ` Arnaldo Carvalho de Melo
2022-09-21 13:49 ` Arnaldo Carvalho de Melo [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=YysWVB724LBSFhII@kernel.org \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.