From: Leo Yan <leo.yan@arm.com>
To: Adrian Hunter <adrian.hunter@intel.com>
Cc: tanze <tanze@kylinos.cn>,
james.clark@linaro.org, leo.yan@linux.dev, irogers@google.com,
john.g.garry@oracle.com, linux-arm-kernel@lists.infradead.org,
linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org,
graham.woodward@arm.com, mike.leach@linaro.org
Subject: Re: [PATCH v2] perf arm_spe: Add a macro definition to handle offset value
Date: Fri, 24 Oct 2025 09:10:29 +0100 [thread overview]
Message-ID: <20251024081029.GT281971@e132581.arm.com> (raw)
In-Reply-To: <22b7b11e-b1fe-4d9d-8749-afe57ea1c35c@intel.com>
On Fri, Oct 24, 2025 at 09:27:25AM +0300, Adrian Hunter wrote:
[...]
> > --- a/tools/perf/util/arm-spe.c
> > +++ b/tools/perf/util/arm-spe.c
> > @@ -1732,7 +1732,7 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
> > attr.sample_period = spe->synth_opts.period;
> >
> > /* create new id val to be a fixed offset from evsel id */
> > - id = evsel->core.id[0] + 1000000000;
> > + id = evsel->core.id[0] + PERF_SYNTH_EVENT_ID_OFFSET;
> >
> > if (!id)
> > id = 1;
>
> Functionally this is to find a free range of IDs for synthesized events,
> but also the range can only have one user e.g. in this case auxtrace
>
> So add to auxtrace.c
>
> #define AUXTRACE_SYNTH_EVENT_ID_OFFSET 1000000000ULL
>
> /*
> * Event IDs are allocated sequentially, so a big offset from any
> * existing ID will reach a unused range.
> */
> u64 auxtrace_synth_id_range_start(struct evsel *evsel)
> {
> u64 id = evsel->core.id[0] + AUXTRACE_SYNTH_EVENT_ID_OFFSET;
>
> if (!id)
> id = 1;
>
> return id;
> }
>
> And then use that:
>
> - /* create new id val to be a fixed offset from evsel id */
> - id = evsel->core.id[0] + 1000000000;
> + id = auxtrace_synth_id_range_start(evsel);
> -
> - if (!id)
> - id = 1;
Agreed, much better than I suggested!
Just remind updating subject as well, like:
perf auxtrace: Refactor AUX event ID calculation
perf auxtrace: Add auxtrace_synth_id_range_start() helper
Thanks,
Leo
prev parent reply other threads:[~2025-10-24 8:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-16 8:30 [PATCH v1] " tanze
2025-10-16 9:09 ` Leo Yan
[not found] ` <1760620322251982.15.seg@mailgw.kylinos.cn>
2025-10-17 1:07 ` tanze
2025-10-17 2:15 ` [PATCH v2] " tanze
2025-10-17 10:09 ` Leo Yan
2025-10-19 3:05 ` Namhyung Kim
2025-10-24 6:27 ` Adrian Hunter
2025-10-24 8:10 ` Leo Yan [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=20251024081029.GT281971@e132581.arm.com \
--to=leo.yan@arm.com \
--cc=adrian.hunter@intel.com \
--cc=graham.woodward@arm.com \
--cc=irogers@google.com \
--cc=james.clark@linaro.org \
--cc=john.g.garry@oracle.com \
--cc=leo.yan@linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mike.leach@linaro.org \
--cc=tanze@kylinos.cn \
/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®