Re: [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace
From: Mike Leach
Date: Tue Mar 17 2026 - 11:12:26 EST
Hi Leo,
On 3/13/26 14:42, Leo Yan wrote:
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.
OK
Reported-by: Leo Yan <leo.yan@xxxxxxx>
Signed-off-by: Mike Leach <mike.leach@xxxxxxx>
---
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.
Looking at cs_etm_decoder__init_raw_frame_logging(), this function is called once, after cs_etm_decoder__init_def_logger_printing(), and unnecessarily repeats a bunch of init calls that are done in that function. The one call needed to set up the extra logging could be folded into cs_etm_decoder__init_def_logger_printing() with the cond compile and d_params checks, removing init_raw_frame_logging() completely
I'll spin up a v2 with this simplification.
Regards
Mike
for (i = 0; i < decoders; i++) {
ret = cs_etm_decoder__create_etm_decoder(d_params,
--
2.43.0