* [PATCH 0/2] perf: tools: cs-etm: Fixes for CoreSight debug dump
@ 2026-03-13 13:21 Mike Leach
2026-03-13 13:21 ` [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace Mike Leach
2026-03-13 13:21 ` [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display Mike Leach
0 siblings, 2 replies; 8+ messages in thread
From: Mike Leach @ 2026-03-13 13:21 UTC (permalink / raw)
To: linux-perf-users, linux-arm-kernel, coresight, linux-kernel, acme
Cc: suzuki.poulose, leo.yan, peterz, mingo, will, mark.rutland,
alexander.shishkin, jolsa, namhyung, Mike Leach
perf will output additional CoreSight debug information, from the
'perf report --dump' command, when the build option CSTRACE_RAW=1
is added to the usual CORESIGHT=1 at build time.
This additional information consists of raw trace data in the form of
CoreSight formatted trace frames. This is intended to be used to
investigate possible issues relating to trace data corruption,
trace hardware issues or problems with decode.
The CoreSight formatted trace frames are used when multiple ETMs trace
into an ETR, and not present when a single ETE traces into the TRBE.
When the build option is used and perf is used to dump an ETE/TRBE
generated buffer a segfault will occur in the OpenCSD library.
Patch 1 of this set removes the unnecessary call to print the raw trace
frames when not needed, and fixes the segfault where older versions
of OpenCSD are in use.
Patch 2 enhances the debug output to associate raw data with individual
packets, which means that raw data is now present for ETE and extended
for ETM.
OpenCSD is being fixed independently.
Mike Leach (2):
perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE
trace
perf: tools: cs-etm: Enhance raw Coresight trace debug display
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace 2026-03-13 13:21 [PATCH 0/2] perf: tools: cs-etm: Fixes for CoreSight debug dump Mike Leach @ 2026-03-13 13:21 ` Mike Leach 2026-03-13 14:42 ` Leo Yan 2026-03-13 13:21 ` [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display Mike Leach 1 sibling, 1 reply; 8+ messages in thread From: Mike Leach @ 2026-03-13 13:21 UTC (permalink / raw) To: linux-perf-users, linux-arm-kernel, coresight, linux-kernel, acme Cc: suzuki.poulose, leo.yan, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa, namhyung, Mike Leach, Leo Yan 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. Fixes: 68ffe3902898 ("perf tools: Add decoder mechanic to support dumping trace data") Reported-by: Leo Yan <leo.yan@arm.com> Signed-off-by: Mike Leach <mike.leach@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); for (i = 0; i < decoders; i++) { ret = cs_etm_decoder__create_etm_decoder(d_params, -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace 2026-03-13 13:21 ` [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace Mike Leach @ 2026-03-13 14:42 ` Leo Yan 2026-03-17 15:09 ` Mike Leach 0 siblings, 1 reply; 8+ messages in thread From: Leo Yan @ 2026-03-13 14:42 UTC (permalink / raw) To: Mike Leach Cc: linux-perf-users, linux-arm-kernel, coresight, linux-kernel, acme, suzuki.poulose, leo.yan, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa, namhyung 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@arm.com> > Signed-off-by: Mike Leach <mike.leach@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 > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace 2026-03-13 14:42 ` Leo Yan @ 2026-03-17 15:09 ` Mike Leach 0 siblings, 0 replies; 8+ messages in thread From: Mike Leach @ 2026-03-17 15:09 UTC (permalink / raw) To: Leo Yan Cc: linux-perf-users, linux-arm-kernel, coresight, linux-kernel, acme, suzuki.poulose, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa, namhyung, nd 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@arm.com> >> Signed-off-by: Mike Leach <mike.leach@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. > 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 >> ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display 2026-03-13 13:21 [PATCH 0/2] perf: tools: cs-etm: Fixes for CoreSight debug dump Mike Leach 2026-03-13 13:21 ` [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace Mike Leach @ 2026-03-13 13:21 ` Mike Leach 2026-03-13 14:45 ` Leo Yan 1 sibling, 1 reply; 8+ messages in thread From: Mike Leach @ 2026-03-13 13:21 UTC (permalink / raw) To: linux-perf-users, linux-arm-kernel, coresight, linux-kernel, acme Cc: suzuki.poulose, leo.yan, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa, namhyung, Mike Leach When compiling perf with CORESIGHT=1, an additional build option may be used: CSTRACE_RAW=1, which will cause the CoreSight formatted trace frames to be printed out during a perf --dump command. This is useful when investigating issues with trace generation, decode or possible data corruption. e.g. for ETMv4 trace source into a formatted ETR sink a dump - . ... CoreSight ETMV4I Trace data: size 0x28c150 bytes Idx:0; ID:14; I_ASYNC : Alignment Synchronisation. Idx:12; ID:14; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }; Decoder Sync point TINFO Idx:17; ID:14; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000; becomes with CSTRACE_RAW=1: . ... CoreSight ETMV4I Trace data: size 0x28c150 bytes Frame Data; Index 0; ID_DATA[0x14]; 00 00 00 00 00 00 00 00 00 00 00 80 01 01 Idx:0; ID:14; I_ASYNC : Alignment Synchronisation. Frame Data; Index 16; ID_DATA[0x14]; 00 9d 00 00 00 00 00 00 00 00 04 85 57 08 f2 Idx:12; ID:14; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }; Decoder Sync point TINFO Idx:17; ID:14; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000; CSTRACE_RAW=1 has no effect on ETE + TRBE trace as there is no trace formatting in the TRBE buffer. This patch enhances the output so that for each packet the individual bytes associated with the packet are printed. Thus for ETMv4 this now becomes: . ... CoreSight ETMV4I Trace data: size 0x28c150 bytes Frame Data; Index 0; ID_DATA[0x14]; 00 00 00 00 00 00 00 00 00 00 00 80 01 01 Idx:0; ID:14;[0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80]; I_ASYNC : Alignment Synchronisation. Frame Data; Index 16; ID_DATA[0x14]; 00 9d 00 00 00 00 00 00 00 00 04 85 57 08 f2 Idx:12; ID:14; [0x01 0x01 0x00 ]; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0 }; Decoder Sync point TINFO Idx:17; ID:14; [0x9d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 ]; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0x0000000000000000; ETE trace output changes from: Idx:0; ID:14; I_ASYNC : Alignment Synchronisation. Idx:12; ID:14; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0, TSTATE.0 }; Decoder Sync point TINFO Idx:15; ID:14; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0xFFFF80007CF7F56C; becoming: Idx:0; ID:14;[0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80]; I_ASYNC : Alignment Synchronisation. Idx:12; ID:14; [0x01 0x01 0x00 ]; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0, TSTATE.0 }; Decoder Sync point TINFO Idx:15; ID:14; [0x9d 0x5b 0x7a 0xf7 0x7c 0x00 0x80 0xff 0xff ]; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; Addr=0xFFFF80007CF7F56C; Signed-off-by: Mike Leach <mike.leach@arm.com> --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 5 ++++- 1 file changed, 4 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 f7e89693cf16..229b28538757 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -22,12 +22,15 @@ /* use raw logging */ #ifdef CS_DEBUG_RAW #define CS_LOG_RAW_FRAMES +#define CS_PKT_MON 1 #ifdef CS_RAW_PACKED #define CS_RAW_DEBUG_FLAGS (OCSD_DFRMTR_UNPACKED_RAW_OUT | \ OCSD_DFRMTR_PACKED_RAW_OUT) #else #define CS_RAW_DEBUG_FLAGS (OCSD_DFRMTR_UNPACKED_RAW_OUT) #endif +#else +#define CS_PKT_MON 0 #endif /* @@ -686,7 +689,7 @@ cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params, trace_config, &csid)) return -1; - if (ocsd_dt_set_pkt_protocol_printer(decoder->dcd_tree, csid, 0)) + if (ocsd_dt_set_pkt_protocol_printer(decoder->dcd_tree, csid, CS_PKT_MON)) return -1; return 0; -- 2.43.0 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display 2026-03-13 13:21 ` [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display Mike Leach @ 2026-03-13 14:45 ` Leo Yan 2026-03-18 12:56 ` Arnaldo Carvalho de Melo 0 siblings, 1 reply; 8+ messages in thread From: Leo Yan @ 2026-03-13 14:45 UTC (permalink / raw) To: Mike Leach Cc: linux-perf-users, linux-arm-kernel, coresight, linux-kernel, acme, leo.yan, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa, namhyung On Fri, Mar 13, 2026 at 01:21:29PM +0000, Coresight ML wrote: [...] > ETE trace output changes from: > > Idx:0; ID:14; I_ASYNC : Alignment Synchronisation. > Idx:12; ID:14; I_TRACE_INFO : Trace Info.; INFO=0x0 { CC.0, TSTATE.0 }; > Decoder Sync point TINFO > Idx:15; ID:14; I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; > Addr=0xFFFF80007CF7F56C; > becoming: > > Idx:0; ID:14;[0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x80]; > I_ASYNC : Alignment Synchronisation. > Idx:12; ID:14; [0x01 0x01 0x00 ]; I_TRACE_INFO : Trace Info.; INFO=0x0 > { CC.0, TSTATE.0 }; Decoder Sync point TINFO > Idx:15; ID:14; [0x9d 0x5b 0x7a 0xf7 0x7c 0x00 0x80 0xff 0xff ]; > I_ADDR_L_64IS0 : Address, Long, 64 bit, IS0.; > Addr=0xFFFF80007CF7F56C; > > Signed-off-by: Mike Leach <mike.leach@arm.com> LGTM and I tested it: Tested-by: Leo Yan <leo.yan@arm.com> ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display 2026-03-13 14:45 ` Leo Yan @ 2026-03-18 12:56 ` Arnaldo Carvalho de Melo 2026-03-18 18:45 ` Namhyung Kim 0 siblings, 1 reply; 8+ messages in thread From: Arnaldo Carvalho de Melo @ 2026-03-18 12:56 UTC (permalink / raw) To: Leo Yan Cc: Mike Leach, linux-perf-users, linux-arm-kernel, coresight, linux-kernel, leo.yan, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa, namhyung On Fri, Mar 13, 2026 at 02:45:18PM +0000, Leo Yan wrote: > LGTM and I tested it: > Tested-by: Leo Yan <leo.yan@arm.com> I think this is perf-tools-next material, Namhyung, please pick this one. Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Ah, BTW, this one I picked up by perusing the https://sashiko.dev list of reviewed patches that were CCed to linux-perf-users: https://sashiko.dev/#/?list=org.kernel.vger.linux-perf-users Thanks, - Arnaldo ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display 2026-03-18 12:56 ` Arnaldo Carvalho de Melo @ 2026-03-18 18:45 ` Namhyung Kim 0 siblings, 0 replies; 8+ messages in thread From: Namhyung Kim @ 2026-03-18 18:45 UTC (permalink / raw) To: Arnaldo Carvalho de Melo Cc: Leo Yan, Mike Leach, linux-perf-users, linux-arm-kernel, coresight, linux-kernel, leo.yan, peterz, mingo, will, mark.rutland, alexander.shishkin, jolsa Hello, On Wed, Mar 18, 2026 at 09:56:26AM -0300, Arnaldo Carvalho de Melo wrote: > On Fri, Mar 13, 2026 at 02:45:18PM +0000, Leo Yan wrote: > > LGTM and I tested it: > > > Tested-by: Leo Yan <leo.yan@arm.com> > > I think this is perf-tools-next material, Namhyung, please pick this > one. Sure, will pick up v2. Thanks, Namhyung > > Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> > > Ah, BTW, this one I picked up by perusing the https://sashiko.dev list > of reviewed patches that were CCed to linux-perf-users: > > https://sashiko.dev/#/?list=org.kernel.vger.linux-perf-users > > Thanks, > > - Arnaldo ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2026-03-18 18:45 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-03-13 13:21 [PATCH 0/2] perf: tools: cs-etm: Fixes for CoreSight debug dump Mike Leach 2026-03-13 13:21 ` [PATCH 1/2] perf: tools: cs-etm: Fix print issue for Coresight debug in ETE/TRBE trace Mike Leach 2026-03-13 14:42 ` Leo Yan 2026-03-17 15:09 ` Mike Leach 2026-03-13 13:21 ` [PATCH 2/2] perf: tools: cs-etm: Enhance raw Coresight trace debug display Mike Leach 2026-03-13 14:45 ` Leo Yan 2026-03-18 12:56 ` Arnaldo Carvalho de Melo 2026-03-18 18:45 ` Namhyung Kim
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox