[PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace

Leo Yan leo.yan at arm.com
Fri Mar 13 07:42:39 PDT 2026


On Fri, Mar 13, 2026 at 01:21:28PM +0000, Mike Leach wrote:
> Building perf with CORESIGHT=1 and the optional CSTRACE_RAW=1 enables
> additional debug printing of raw trace data when using command:-
> perf report --dump.
> 
> This raw trace prints the CoreSight formatted trace frames, which may be
> used to investigate suspected issues with trace quality / corruption /
> decode.
> 
> These frames are not present in ETE + TRBE trace.
> This fix removes the unnecessary call to print these frames.
> 
> Due to an addtional fault with the OpenCSD library, this call when ETE/TRBE
> are being decoded will cause a segfault in perf. This fix also prevents
> that problem for perf using older (<= 1.8.0 version) OpenCSD libraries.

Thanks for patches!

> Fixes: 68ffe3902898 ("perf tools: Add decoder mechanic to support dumping trace data")
> 

Redundant empty line.

> Reported-by: Leo Yan <leo.yan at arm.com>
> Signed-off-by: Mike Leach <mike.leach at arm.com>
> ---
>  tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> index 3050fe212666..f7e89693cf16 100644
> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
> @@ -739,7 +739,8 @@ cs_etm_decoder__new(int decoders, struct cs_etm_decoder_params *d_params,
>  		goto err_free_decoder;
>  
>  	/* init raw frame logging if required */
> -	cs_etm_decoder__init_raw_frame_logging(d_params, decoder);
> +	if (format == OCSD_TRC_SRC_FRAME_FORMATTED)
> +		cs_etm_decoder__init_raw_frame_logging(d_params, decoder);

Could we improve a bit to add checking in
cs_etm_decoder__init_raw_frame_logging(), something like:

 cs_etm_decoder__init_raw_frame_logging(struct cs_etm_decoder_params *d_params,
                                       struct cs_etm_decoder *decoder)
 {
+       /* No formatted trace frames */
+       if (!d_params->formatted)
+               return;

Sorry I should have mentioned this early.

>  
>  	for (i = 0; i < decoders; i++) {
>  		ret = cs_etm_decoder__create_etm_decoder(d_params,
> -- 
> 2.43.0
> 



More information about the linux-arm-kernel mailing list