From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Namhyung Kim <namhyung@kernel.org>
Cc: Ian Rogers <irogers@google.com>,
Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Kan Liang <kan.liang@linux.intel.com>,
Masahiro Yamada <masahiroy@kernel.org>,
Arnd Bergmann <arnd@arndb.de>, Jann Horn <jannh@google.com>,
Colin Ian King <colin.i.king@gmail.com>,
Casey Chen <cachen@purestorage.com>,
Athira Rajeev <atrajeev@linux.vnet.ibm.com>,
Chaitanya S Prakash <chaitanyas.prakash@arm.com>,
James Clark <james.clark@linaro.org>,
Ze Gao <zegao2021@gmail.com>,
Yang Jihong <yangjihong1@huawei.com>,
Yunseong Kim <yskelg@gmail.com>,
Weilin Wang <weilin.wang@intel.com>,
Dominique Martinet <asmadeus@codewreck.org>,
Anne Macedo <retpolanne@posteo.net>,
Sun Haiyong <sunhaiyong@loongson.cn>,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 10/13] perf inject: Fix build ID injection
Date: Tue, 3 Sep 2024 15:34:00 -0300 [thread overview]
Message-ID: <ZtdWmLlZp9HO8wK-@x1> (raw)
In-Reply-To: <ZtYDQVrVIk5zWK16@google.com>
On Mon, Sep 02, 2024 at 11:26:09AM -0700, Namhyung Kim wrote:
> Hi Ian,
>
> On Wed, Aug 28, 2024 at 08:15:10AM -0700, Ian Rogers wrote:
> > On Mon, Aug 19, 2024 at 12:54 PM Ian Rogers <irogers@google.com> wrote:
> > >
> > > On Mon, Aug 19, 2024 at 11:01 AM Arnaldo Carvalho de Melo
> > > <acme@kernel.org> wrote:
> > > >
> > > > On Fri, Aug 16, 2024 at 11:44:39PM -0700, Ian Rogers wrote:
> > > > > Build ID injection wasn't inserting a sample ID and aligning events to
> > > > > 64 bytes rather than 8. No sample ID means events are unordered and
> > > > > two different build_id events for the same path, as happens when a
> > > > > file is replaced, can't be differentiated.
> > > > >
> > > > > Add in sample ID insertion for the build_id events alongside some
> > > > > refactoring. The refactoring better aligns the function arguments for
> > > > > different use cases, such as synthesizing build_id events without
> > > > > needing to have a dso. The misc bits are explicitly passed as with
> > > > > callchains the maps/dsos may span user and kernel land, so using
> > > > > sample->cpumode isn't good enough.
> > > > >
> > > > > Signed-off-by: Ian Rogers <irogers@google.com>
> > > > > ---
> > > > > tools/perf/builtin-inject.c | 170 ++++++++++++++++++++++-------
> > > > > tools/perf/util/build-id.c | 6 +-
> > > > > tools/perf/util/synthetic-events.c | 44 ++++++--
> > > > > tools/perf/util/synthetic-events.h | 10 +-
> > > > > 4 files changed, 175 insertions(+), 55 deletions(-)
> > > > >
> > > > > diff --git a/tools/perf/builtin-inject.c b/tools/perf/builtin-inject.c
> > > > > index a7c859db2e15..84a4bdb5cb0a 100644
> > > > > --- a/tools/perf/builtin-inject.c
> > > > > +++ b/tools/perf/builtin-inject.c
> > > > > @@ -131,6 +131,7 @@ struct perf_inject {
> > > > > struct perf_file_section secs[HEADER_FEAT_BITS];
> > > > > struct guest_session guest_session;
> > > > > struct strlist *known_build_ids;
> > > > > + const struct evsel *mmap_evsel;
> > > > > };
> > > > >
> > > > > struct event_entry {
> > > > > @@ -139,8 +140,13 @@ struct event_entry {
> > > > > union perf_event event[];
> > > > > };
> > > > >
> > > > > -static int dso__inject_build_id(struct dso *dso, const struct perf_tool *tool,
> > > > > - struct machine *machine, u8 cpumode, u32 flags);
> > > > > +static int dso__inject_build_id(const struct perf_tool *tool,
> > > > > + struct perf_sample *sample,
> > > > > + struct machine *machine,
> > > > > + const struct evsel *evsel,
> > > > > + __u16 misc,
> > > > > + const char *filename,
> > > > > + struct dso *dso, u32 flags);
> > > >
> > > > So in the end the dso was needed, the name of the function remains
> > > > dso__something(), so first arg would be a 'struct dso *'
> > > >
> > > > I processed the patches up to 9/13, so that they can get tested now.
> > >
> > > Maybe we should rename the function? We can get the build ID from
> > > mmap2 events now, not just stored away in the dso by build_id events.
> > > Reordering the arguments isn't a problem, I was just aiming for
> > > consistency between the caller, perf_event__synthesize_build_id and
> > > eventually the call to process that all take the arguments in this
> > > order.
> >
> > Arnaldo, did you have any more thoughts on this?
>
> I'm ok to rename it to tool__inject_build_id().
I thought I had this processed, but I stopped at this patch, yeah,
please rebase on top of perf-tools-next with the suggested rename.
- Arnaldo
next prev parent reply other threads:[~2024-09-03 18:34 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-17 6:44 [PATCH v1 00/13] perf inject improvements Ian Rogers
2024-08-17 6:44 ` [PATCH v1 01/13] perf synthetic-events: Avoid unnecessary memset Ian Rogers
2024-08-17 6:44 ` [PATCH v1 02/13] perf map: API clean up Ian Rogers
2024-08-17 6:44 ` [PATCH v1 03/13] perf jit: Constify filename argument Ian Rogers
2024-08-17 6:44 ` [PATCH v1 04/13] perf dso: Constify dso_id Ian Rogers
2024-08-17 6:44 ` [PATCH v1 05/13] perf evsel: Constify evsel__id_hdr_size argument Ian Rogers
2024-08-17 6:44 ` [PATCH v1 06/13] perf test: Expand pipe/inject test Ian Rogers
2024-08-17 6:44 ` [PATCH v1 07/13] perf inject: Combine build_ids and build_id_all into enum Ian Rogers
2024-08-17 6:44 ` [PATCH v1 08/13] perf inject: Combine different mmap and mmap2 functions Ian Rogers
2024-08-17 6:44 ` [PATCH v1 09/13] perf inject: Combine mmap and mmap2 handling Ian Rogers
2024-08-17 6:44 ` [PATCH v1 10/13] perf inject: Fix build ID injection Ian Rogers
2024-08-19 18:01 ` Arnaldo Carvalho de Melo
2024-08-19 19:54 ` Ian Rogers
2024-08-28 15:15 ` Ian Rogers
2024-09-02 18:26 ` Namhyung Kim
2024-09-03 18:34 ` Arnaldo Carvalho de Melo [this message]
2024-08-17 6:44 ` [PATCH v1 11/13] perf inject: Add new mmap2-buildid-all option Ian Rogers
2024-08-17 6:44 ` [PATCH v1 12/13] perf inject: Lazy build-id mmap2 event insertion Ian Rogers
2024-08-17 6:44 ` [PATCH v1 13/13] perf callchain: Allow symbols to be optional when resolving a callchain Ian Rogers
2024-09-02 18:27 ` [PATCH v1 00/13] perf inject improvements 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=ZtdWmLlZp9HO8wK-@x1 \
--to=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=arnd@arndb.de \
--cc=asmadeus@codewreck.org \
--cc=atrajeev@linux.vnet.ibm.com \
--cc=cachen@purestorage.com \
--cc=chaitanyas.prakash@arm.com \
--cc=colin.i.king@gmail.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=jannh@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=masahiroy@kernel.org \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
--cc=retpolanne@posteo.net \
--cc=sunhaiyong@loongson.cn \
--cc=weilin.wang@intel.com \
--cc=yangjihong1@huawei.com \
--cc=yskelg@gmail.com \
--cc=zegao2021@gmail.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 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.