Re: [PATCH v3 3/4] perf cs-etm: Synthesize missing HW_ID mappings for raw trace

From: James Clark

Date: Mon Oct 05 2026 - 04:36:12 EST




On 02/10/2026 18:14, Leo Yan wrote:
On Fri, Oct 02, 2026 at 12:15:13PM +0100, James Clark wrote:

[...]

static struct cs_etm_queue *cs_etm__get_queue(struct cs_etm_auxtrace *etm, int cpu)
@@ -314,12 +317,11 @@ static int cs_etm__map_trace_id_v0(struct cs_etm_auxtrace *etm, u8 trace_chan_id
return -EINVAL;
/*
- * If the queue is unformatted then only save one mapping in the
- * queue associated with that CPU so only one decoder is made.
+ * Ignore HW_IDs for unformatted, a decoder will be made
+ * unconditionally later.
*/
if (etmq->format == UNFORMATTED)
- return cs_etm__insert_trace_id_node(etmq, trace_chan_id,
- cpu_metadata);
+ return 0;

Nitpick: It seems to me that we can move the
etmq->format == UNFORMATTED check into cs_etm__process_aux_output_hw_id().

This avoids duplicating the check in both cs_etm__map_trace_id_v0()
and cs_etm__process_trace_id_v0_1(), and makes it more apparent that
the unformatted case does not use HW_ID at all.

It's up to you whether to keep it as is or update it. Either way:


I might leave it for now. It's also called by cs_etm__map_trace_ids_metadata() which doesn't have a reference to the queue, and neither does cs_etm__process_aux_output_hw_id(). Probably not worth another refactor at this point.

Reviewed-by: Leo Yan leo.yan@xxxxxxx

P.S. Although I contributed the initial idea, the change is now quite
different from the original patch I shared. Please feel free to drop my
name if you prefer.

Will do if I send another one, but it looks like it can be applied now so it might have to stay.