[PATCH 3/6] perf cs-etm: Synthesize missing HW_ID mappings for raw trace
James Clark
james.clark at linaro.org
Thu Oct 1 05:55:23 PDT 2026
On 04/09/2026 18:29, Leo Yan wrote:
> On Fri, Aug 21, 2026 at 10:50:31AM +0100, James Clark wrote:
>
> [...]
>
>> +static int cs_etm__synth_unformatted_trace_ids(struct cs_etm_auxtrace *etm)
>> +{
>> + struct auxtrace_queues *queues = &etm->queues;
>> +
>> + for (unsigned int i = 0; i < queues->nr_queues; i++) {
>> + struct auxtrace_queue *queue = &queues->queue_array[i];
>> + struct cs_etm_queue *etmq = queue->priv;
>> + u64 *cpu_data;
>> + u8 trace_id;
>> + int ret;
>> +
>> + if (list_empty(&queue->head) || !etmq || etmq->format != UNFORMATTED)
>> + continue;
>> +
>> + if (!intlist__empty(etmq->traceid_list))
>> + continue;
>> +
>> + cpu_data = get_cpu_data(etm, queue->cpu);
>> + if (!cpu_data)
>> + return -EINVAL;
>> +
>> + ret = cs_etm__metadata_get_trace_id(&trace_id, cpu_data);
>> + if (ret)
>> + return ret;
>
> Since this is an unformatted queue, can we simply ignore the trace ID?
> Instead of fetching it from the metadata, we could insert 0 to create
> the trace ID list.
>
It's printed in the raw output though and it's useful for eyeballing
which CPU any bit of trace ran on because the AUXTRACE header might be
off the page, and it makes output consistent with ETM:
. ... CoreSight ETE Trace data: size 0x10000 bytes
Idx:0; ID:22; I_ASYNC : Alignment Synchronisation.
I don't think it costs anything or is complex to do this, but if you
really want to set them all to 0 we could do it.
> This would also align with future refactoring to remove trace ID
> handling for unformatted queues.
At that point if they're all going to be 0 then we can ignore all
processing of HW_ID events for UNFORMATTED. Instead of saying
cs_etm__synth_unformatted_trace_ids() is for 'fixing up missing IDs' it
just creates them outright.
More information about the linux-arm-kernel
mailing list