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

Leo Yan leo.yan at arm.com
Fri Oct 2 10:14:05 PDT 2026


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:

Reviewed-by: Leo Yan leo.yan at arm.com

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.



More information about the linux-arm-kernel mailing list