lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251024081029.GT281971@e132581.arm.com>
Date: Fri, 24 Oct 2025 09:10:29 +0100
From: Leo Yan <leo.yan@....com>
To: Adrian Hunter <adrian.hunter@...el.com>
Cc: tanze <tanze@...inos.cn>, james.clark@...aro.org, leo.yan@...ux.dev,
	irogers@...gle.com, john.g.garry@...cle.com,
	linux-arm-kernel@...ts.infradead.org,
	linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
	graham.woodward@....com, mike.leach@...aro.org
Subject: Re: [PATCH v2] perf arm_spe: Add a macro definition to handle offset
 value

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ