]> www.infradead.org Git - users/hch/misc.git/commitdiff
perf arm-spe: Display --itrace period warnings for all sample types
authorJames Clark <james.clark@linaro.org>
Mon, 8 Sep 2025 12:10:20 +0000 (13:10 +0100)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Tue, 9 Sep 2025 17:51:07 +0000 (14:51 -0300)
Currently we only display the warning when the instructions group is
requested. Instructions are on by default, and the period applies to all
sample types anyway so always check the options and show the warning.

Reword the messages to be more explicit about which flags the warnings
apply to.

Signed-off-by: James Clark <james.clark@linaro.org>
Tested-by: Leo Yan <leo.yan@arm.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ben Gainey <Ben.Gainey@arm.com>
Cc: George Wort <George.Wort@arm.com>
Cc: Graham Woodward <Graham.Woodward@arm.com>
Cc: Ian Rogers <irogers@google.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: John Garry <john.g.garry@oracle.com>
Cc: Leo Yan <leo.yan@linux.dev>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Michael Williams <Michael.Williams@arm.com>
Cc: Mike Leach <mike.leach@linaro.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
tools/perf/util/arm-spe.c

index 4c81518a033a7d96fcb5c39c1a45acdf45631553..228ed52e653d7873c1d07404671447db03a10e59 100644 (file)
@@ -1742,14 +1742,6 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
        }
 
        if (spe->synth_opts.instructions) {
-               if (spe->synth_opts.period_type != PERF_ITRACE_PERIOD_INSTRUCTIONS) {
-                       pr_warning("Only instruction-based sampling period is currently supported by Arm SPE.\n");
-                       goto synth_instructions_out;
-               }
-               if (spe->synth_opts.period > 1)
-                       pr_warning("Arm SPE has a hardware-based sample period.\n"
-                                  "Additional instruction events will be discarded by --itrace\n");
-
                spe->sample_instructions = true;
                attr.config = PERF_COUNT_HW_INSTRUCTIONS;
 
@@ -1759,7 +1751,6 @@ arm_spe_synth_events(struct arm_spe *spe, struct perf_session *session)
                spe->instructions_id = id;
                arm_spe_set_event_name(evlist, id, "instructions");
        }
-synth_instructions_out:
 
        return 0;
 }
@@ -1877,6 +1868,15 @@ int arm_spe_process_auxtrace_info(union perf_event *event,
                spe->synth_opts.period = 1;
        }
 
+       if (spe->synth_opts.period_type != PERF_ITRACE_PERIOD_INSTRUCTIONS) {
+               ui__error("You must only use i (instructions) --itrace period with Arm SPE. e.g --itrace=i1i\n");
+               err = -EINVAL;
+               goto err_free_queues;
+       }
+       if (spe->synth_opts.period > 1)
+               ui__warning("Arm SPE has a hardware-based sampling period.\n\n"
+                           "--itrace periods > 1i downsample by an interval of n SPE samples rather than n instructions.\n");
+
        err = arm_spe_synth_events(spe, session);
        if (err)
                goto err_free_queues;