From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Jiri Olsa <jolsa@redhat.com>, Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Andi Kleen <ak@linux.intel.com>, Ian Rogers <irogers@google.com>
Subject: Re: [PATCH 3/3] perf annotate: Try chroot filename for objdump
Date: Tue, 1 Feb 2022 21:06:15 -0300 [thread overview]
Message-ID: <YfnK95pk1AzcL7LZ@kernel.org> (raw)
In-Reply-To: <CAM9d7cgpkzhmEAhnUA39YOVaHFw_-A2yzMX9zE9JbE+pFVBVGw@mail.gmail.com>
Em Tue, Feb 01, 2022 at 11:54:14AM -0800, Namhyung Kim escreveu:
> Hi Jiri,
>
> On Mon, Jan 31, 2022 at 11:23 AM Jiri Olsa <jolsa@redhat.com> wrote:
> >
> > On Fri, Jan 28, 2022 at 12:39:50PM -0800, Namhyung Kim wrote:
> > > Likewise, it should use a proper name in case the task runs under
> > > chroot. The child_process.err was needed to set to -1 to show error
> > > messages properly in TUI.
> > >
> > > Signed-off-by: Namhyung Kim <namhyung@kernel.org>
> > > ---
> > > tools/perf/util/annotate.c | 11 +++++++++++
> > > 1 file changed, 11 insertions(+)
> > >
> > > diff --git a/tools/perf/util/annotate.c b/tools/perf/util/annotate.c
> > > index 01900689dc00..e4c641b240df 100644
> > > --- a/tools/perf/util/annotate.c
> > > +++ b/tools/perf/util/annotate.c
> > > @@ -33,6 +33,7 @@
> > > #include "string2.h"
> > > #include "util/event.h"
> > > #include "arch/common.h"
> > > +#include "namespaces.h"
> > > #include <regex.h>
> > > #include <pthread.h>
> > > #include <linux/bitops.h>
> > > @@ -1696,6 +1697,15 @@ static int dso__disassemble_filename(struct dso *dso, char *filename, size_t fil
> > > * DSO is the same as when 'perf record' ran.
> > > */
> > > __symbol__join_symfs(filename, filename_size, dso->long_name);
> > > +
> > > + if (access(filename, R_OK) && errno == ENOENT && dso->nsinfo) {
> > > + char *new_name = filename_with_chroot(dso->nsinfo->pid,
> > > + filename);
> > > + if (new_name) {
> > > + strlcpy(filename, new_name, filename_size);
> > > + free(new_name);
> > > + }
> > > + }
> > > }
> > >
> > > free(build_id_path);
> > > @@ -2036,6 +2046,7 @@ static int symbol__disassemble(struct symbol *sym, struct annotate_args *args)
> > > memset(&objdump_process, 0, sizeof(objdump_process));
> > > objdump_process.argv = objdump_argv;
> > > objdump_process.out = -1;
> > > + objdump_process.err = -1;
> >
> > is this unrelated fix?
>
> Right, it's unrelated. Maybe I can split it if Arnaldo wants.
Yes, please split.
> >
> > otherwise the whole patchset looks good to me
> >
> > I guess we'd need to add something like PERF_RECORD_CHROOT to
> > handle and instrument sys_chroot to handle this completely?
>
> Are you talking about an env variable? Maybe we can track
> chroot syscall. But it needs to be task-specific rather than a
> global setup.
>
> As it hasn't been an issue so far, I think it's ok to have it as
> a fallback right now.
>
> >
> > Acked-by: Jiri Olsa <jolsa@kernel.org>
>
> Thanks for your review!
Indeed, thank you guys!
> Namhyung
>
>
> >
> > > if (start_command(&objdump_process)) {
> > > pr_err("Failure starting to run %s\n", command);
> > > err = -1;
> > > --
> > > 2.35.0.rc2.247.g8bbb082509-goog
> > >
> >
--
- Arnaldo
next prev parent reply other threads:[~2022-02-02 0:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-28 20:39 [PATCH 0/3] Handle chroot tasks properly (v1) Namhyung Kim
2022-01-28 20:39 ` [PATCH 1/3] perf tools: Try chroot'ed filename when opening dso/symbol Namhyung Kim
2022-01-28 20:39 ` [PATCH 2/3] perf inject: Try chroot directory when reading build-id Namhyung Kim
2022-01-28 20:39 ` [PATCH 3/3] perf annotate: Try chroot filename for objdump Namhyung Kim
2022-01-31 19:23 ` Jiri Olsa
2022-02-01 19:54 ` Namhyung Kim
2022-02-02 0:06 ` Arnaldo Carvalho de Melo [this message]
2022-02-01 1:16 ` [PATCH 0/3] Handle chroot tasks properly (v1) Andi Kleen
2022-02-01 20:01 ` Namhyung Kim
2022-02-02 0:11 ` 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=YfnK95pk1AzcL7LZ@kernel.org \
--to=acme@kernel.org \
--cc=ak@linux.intel.com \
--cc=irogers@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@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.