[PATCH 4/6] perf: cs-etm: Respect --no-itrace option

James Clark james.clark at linaro.org
Thu Oct 1 05:57:02 PDT 2026



On 04/09/2026 18:45, Leo Yan wrote:
> On Fri, Aug 21, 2026 at 10:50:32AM +0100, James Clark wrote:
> 
> [...]
> 
>> @@ -3603,27 +3603,49 @@ int cs_etm__process_auxtrace_info_full(union perf_event *event,
>>   	int err = 0;
>>   	int aux_hw_id_found;
>>   	int i;
>> -	u64 *ptr = NULL;
>> +	u64 *ptr = (u64 *) auxtrace_info->priv;
>>   	u64 **metadata = NULL;
>>   
>> -	/* First the global part */
>> -	ptr = (u64 *) auxtrace_info->priv;
>> -	num_cpu = ptr[CS_PMU_TYPE_CPUS] & 0xffffffff;
>> +	etm = zalloc(sizeof(*etm));
>> +	if (!etm)
>> +		return -ENOMEM;
>> +
>> +	session->auxtrace = &etm->auxtrace;
>> +	etm->auxtrace.free = cs_etm__free;
>> +	etm->auxtrace.evsel_is_auxtrace = cs_etm__evsel_is_auxtrace;
>> +	etm->auxtrace.process_event = cs_etm__process_event;
>> +	etm->auxtrace.process_auxtrace_event = cs_etm__process_auxtrace_event;
>> +	etm->auxtrace.flush_events = cs_etm__flush_events;
>> +	etm->auxtrace.free_events = cs_etm__free_events;
>> +	etm->pmu_type = (unsigned int) ((ptr[CS_PMU_TYPE_CPUS] >> 32) & 0xffffffff);
>> +
>> +	/*
>> +	 * Don't go further than the minimum required to identify this event as
>> +	 * auxtrace with cs_etm__evsel_is_auxtrace() so unleader_auxtrace()
>> +	 * works.
>> +	 */
>> +	if (auxtrace__dont_decode(session))
>> +		return 0;
> 
> TBH, I don't look in details, currently auxtrace__dont_decode() only
> exits in the common util/auxtrace.c, why other AUX trace can work well
> the option but cs-etm.c needs particular initialization?
> 
> Seems to me, we even don't need to do any initialization in cs-etm.c
> if the no-itrace flag is set.

Because we have 2 peek() passes over the file which can hit processing 
errors at this point. I assume other users have a fairly trivial 
process_auxtrace_info() callback which can never fail.



More information about the linux-arm-kernel mailing list