On 24/04/2023 14:47, James Clark wrote:
In this context, timeless refers to the trace data rather than the perf event data. But when detecting whether there are timestamps in the trace data or not, the presence of a timestamp flag on any perf event is used.
Since commit f42c0ce573df ("perf record: Always get text_poke events with --kcore option") timestamps were added to a tracking event when --kcore is used which breaks this detection mechanism. Fix it by detecting if trace timestamps exist by looking at the ETM config flags. This would have always been a more accurate way of doing it anyway.
This fixes the following error message when using --kcore with Coresight:
$ perf record --kcore -e cs_etm// --per-thread $ perf report The perf.data/data data has no samples!
Fixes: f42c0ce573df ("perf record: Always get text_poke events with --kcore option") Reported-by: Yang Shi shy828301@gmail.com Link: https://lore.kernel.org/lkml/CAHbLzkrJQTrYBtPkf=jf3OpQ-yBcJe7XkvQstX9j2frz4W... Signed-off-by: James Clark james.clark@arm.com
tools/perf/util/cs-etm.c | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 8dd81ddd9e4e..50593289d53c 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -2684,26 +2684,29 @@ static int cs_etm__process_auxtrace_event(struct perf_session *session, return 0; } -static bool cs_etm__is_timeless_decoding(struct cs_etm_auxtrace *etm) +static int cs_etm__setup_timeless_decoding(struct cs_etm_auxtrace *etm)
minor nit: "setup" sound more like prepare to do what is required to do a timeless decoding, while we are doing more like, check if we have to do a timeless decoding. So may be:
cs_etm_check_timeless_decoding() ?
{ struct evsel *evsel; struct evlist *evlist = etm->session->evlist;
- bool timeless_decoding = true;
/* Override timeless mode with user input from --itrace=Z */
- if (etm->synth_opts.timeless_decoding)
return true;
- if (etm->synth_opts.timeless_decoding) {
etm->timeless_decoding = true;
return 0;
- }
/*
* Circle through the list of event and complain if we find one
* with the time bit set.
*/* Find the cs_etm evsel and look at what its timestamp setting was
- evlist__for_each_entry(evlist, evsel) {
if ((evsel->core.attr.sample_type & PERF_SAMPLE_TIME))
timeless_decoding = false;
- }
- evlist__for_each_entry(evlist, evsel)
minor nit: please retain the braces
if (cs_etm__evsel_is_auxtrace(etm->session, evsel)) {
etm->timeless_decoding =
!(evsel->core.attr.config & BIT(ETM_OPT_TS));
return 0;
}
Otherwise, looks good to me
Suzuki