linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Adrian Hunter <adrian.hunter@intel.com>
To: Namhyung Kim <namhyung@kernel.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Ian Rogers <irogers@google.com>,
	linux-perf-users@vger.kernel.org
Subject: Re: [PATCH 4/4] perf tools: Honor namespace when synthesizing build-id
Date: Tue, 20 Sep 2022 16:36:43 +0300	[thread overview]
Message-ID: <a50941ad-ae74-933e-4d22-f4c67bafc0c1@intel.com> (raw)
In-Reply-To: <20220916175902.1155177-5-namhyung@kernel.org>

On 16/09/22 20:59, Namhyung Kim wrote:
> It needs to go into a namespace before reading a file.

This looks like a fix, in which case make it the first patch
and add a fixes tag?

> 
> Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> ---
>  tools/perf/util/synthetic-events.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/tools/perf/util/synthetic-events.c b/tools/perf/util/synthetic-events.c
> index e6978b2dee8f..d0d540d09196 100644
> --- a/tools/perf/util/synthetic-events.c
> +++ b/tools/perf/util/synthetic-events.c
> @@ -391,6 +391,8 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
>  	struct build_id _bid, *bid = &_bid;
>  	struct dso *dso = NULL;
>  	struct dso_id id;
> +	struct nsinfo *nsi;
> +	struct nscookie nc;
>  	int rc;
>  
>  	if (is_kernel) {
> @@ -410,8 +412,14 @@ static void perf_record_mmap2__read_build_id(struct perf_record_mmap2 *event,
>  		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));


  reply	other threads:[~2022-09-20 13:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-16 17:58 [PATCH 0/4] perf tools: Fix MMAP2 build-ID synthesis in namespaces (v1) Namhyung Kim
2022-09-16 17:58 ` [PATCH 1/4] perf tools: Move dsos functions to util/dsos.c Namhyung Kim
2022-09-20 13:51   ` Adrian Hunter
2022-09-20 17:49     ` Namhyung Kim
2022-09-16 17:59 ` [PATCH 2/4] perf tools: Add perf_event__synthesize_{start,stop}() Namhyung Kim
2022-09-20 13:50   ` Adrian Hunter
2022-09-20 18:17     ` Namhyung Kim
2022-09-16 17:59 ` [PATCH 3/4] perf record: Save DSO build-ID for synthesizing Namhyung Kim
2022-09-20 13:59   ` Adrian Hunter
2022-09-20 18:30     ` Namhyung Kim
2022-09-21  7:26       ` Adrian Hunter
2022-09-21 10:11         ` Adrian Hunter
2022-09-16 17:59 ` [PATCH 4/4] perf tools: Honor namespace when synthesizing build-id Namhyung Kim
2022-09-20 13:36   ` Adrian Hunter [this message]
2022-09-20 18: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=a50941ad-ae74-933e-4d22-f4c67bafc0c1@intel.com \
    --to=adrian.hunter@intel.com \
    --cc=acme@kernel.org \
    --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 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 NNTP newsgroup(s).