Previously when the incorrect binary was used for decode, Perf would
silently continue to generate incorrect samples. With OpenCSD 1.5.4 we
can enable consistency checks that do a best effort to detect a mismatch
in the image. When one is detected a warning is printed and sample
generation stops until the trace resynchronizes with a good part of the
image.
Reported-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
Closes: https://lore.kernel.org/all/20240719092619.274730-1-gankulkarni@os.amperecomputing.com/
Signed-off-by: James Clark <james.clark@linaro.org>
---
tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 7 ++++++-
1 file changed, 6 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 b78ef0262135..b85a8837bddc 100644
--- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
+++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c
@@ -685,9 +685,14 @@ cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params,
}
if (d_params->operation == CS_ETM_OPERATION_DECODE) {
+ int decode_flags = OCSD_CREATE_FLG_FULL_DECODER;
+#ifdef OCSD_OPFLG_N_UNCOND_DIR_BR_CHK
+ decode_flags |= OCSD_OPFLG_N_UNCOND_DIR_BR_CHK | OCSD_OPFLG_CHK_RANGE_CONTINUE |
+ ETM4_OPFLG_PKTDEC_AA64_OPCODE_CHK;
+#endif
if (ocsd_dt_create_decoder(decoder->dcd_tree,
decoder->decoder_name,
- OCSD_CREATE_FLG_FULL_DECODER,
+ decode_flags,
trace_config, &csid))
return -1;
--
2.34.1
On 9/12/24 16:11, James Clark wrote:> > > Previously when the incorrect binary was used for decode, Perf would > silently continue to generate incorrect samples. With OpenCSD 1.5.4 we > can enable consistency checks that do a best effort to detect a mismatch > in the image. When one is detected a warning is printed and sample > generation stops until the trace resynchronizes with a good part of the > image. > > Reported-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> > Closes: https://lore.kernel.org/all/20240719092619.274730-1-gankulkarni@os.amperecomputing.com/ > Signed-off-by: James Clark <james.clark@linaro.org> > --- > tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 7 ++++++- > 1 file changed, 6 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 b78ef0262135..b85a8837bddc 100644 > --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c > @@ -685,9 +685,14 @@ cs_etm_decoder__create_etm_decoder(struct cs_etm_decoder_params *d_params, > } > > if (d_params->operation == CS_ETM_OPERATION_DECODE) { > + int decode_flags = OCSD_CREATE_FLG_FULL_DECODER; > +#ifdef OCSD_OPFLG_N_UNCOND_DIR_BR_CHK > + decode_flags |= OCSD_OPFLG_N_UNCOND_DIR_BR_CHK | OCSD_OPFLG_CHK_RANGE_CONTINUE | > + ETM4_OPFLG_PKTDEC_AA64_OPCODE_CHK; > +#endif Looks good to me. Just one question: should the flag ETM4_OPFLG_PKTDEC_AA64_OPCODE_CHK be set according to ETM version? E.g. it should be only set for ETMv4 or this is fine for ETE as well. Thanks, Leo > if (ocsd_dt_create_decoder(decoder->dcd_tree, > decoder->decoder_name, > - OCSD_CREATE_FLG_FULL_DECODER, > + decode_flags, > trace_config, &csid)) > return -1; > > -- > 2.34.1 >
On 13/09/2024 12:54, Leo Yan wrote: > On 9/12/24 16:11, James Clark wrote:> >> >> Previously when the incorrect binary was used for decode, Perf would >> silently continue to generate incorrect samples. With OpenCSD 1.5.4 we >> can enable consistency checks that do a best effort to detect a mismatch >> in the image. When one is detected a warning is printed and sample >> generation stops until the trace resynchronizes with a good part of the >> image. >> >> Reported-by: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> >> Closes: >> https://lore.kernel.org/all/20240719092619.274730-1-gankulkarni@os.amperecomputing.com/ >> Signed-off-by: James Clark <james.clark@linaro.org> >> --- >> tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 7 ++++++- >> 1 file changed, 6 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 b78ef0262135..b85a8837bddc 100644 >> --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c >> +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c >> @@ -685,9 +685,14 @@ cs_etm_decoder__create_etm_decoder(struct >> cs_etm_decoder_params *d_params, >> } >> >> if (d_params->operation == CS_ETM_OPERATION_DECODE) { >> + int decode_flags = OCSD_CREATE_FLG_FULL_DECODER; >> +#ifdef OCSD_OPFLG_N_UNCOND_DIR_BR_CHK >> + decode_flags |= OCSD_OPFLG_N_UNCOND_DIR_BR_CHK | >> OCSD_OPFLG_CHK_RANGE_CONTINUE | >> + ETM4_OPFLG_PKTDEC_AA64_OPCODE_CHK; >> +#endif > > Looks good to me. > > Just one question: should the flag ETM4_OPFLG_PKTDEC_AA64_OPCODE_CHK be set > according to ETM version? E.g. it should be only set for ETMv4 or this is > fine for ETE as well. > > Thanks, > Leo > I asked Mike the same question about ETMv3 and he said none of the flags overlap and it was ok to always pass them. So I assume the same applies to ETE as well.
On 9/13/24 13:09, James Clark wrote: [...] >> Just one question: should the flag ETM4_OPFLG_PKTDEC_AA64_OPCODE_CHK be set >> according to ETM version? E.g. it should be only set for ETMv4 or this is >> fine for ETE as well. > > I asked Mike the same question about ETMv3 and he said none of the flags > overlap and it was ok to always pass them. So I assume the same applies > to ETE as well. Thanks for confirmation. This is my review tag: Reviewed-by: Leo Yan <leo.yan@arm.com>
© 2016 - 2024 Red Hat, Inc.