perf arm-spe: Report error if set frequency
Subsystems (2)
PATCH v2 1/1 perf arm-spe: Report error if set frequency
When users set the parameter '-F' to specify frequency for Arm SPE, the tool reports error:
perf record -F 1000 -e arm_spe_0// -- sleep 1
Error:
Invalid event (arm_spe_0//) in per-thread mode, enable system wide with '-a'.
The output logs are confused and it does not give the correct reminding. Arm SPE does not support frequency setting given it adopts a statistical based approach.
Alternatively, Arm SPE supports setting period. This commit adds a for frequency setting. It reports error and reminds users to set period instead.
After:
perf record -F 1000 -e arm_spe_0// -- sleep 1
Arm SPE: Frequency is not supported. Set period with -c option or PMU parameter (-e arm_spe_0/period=NUM/).
---
Changes from v1:
- Sugguested users for '-c' option or PMU parameter 'period' in the log (Namhyung)
tools/perf/arch/arm64/util/arm-spe.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)
tools/perf/arch/arm64/util/arm-spe.c +21 -0
@@ -40,6 +40,19 @@ struct arm_spe_recording {bool *wrapped; }; +/* Iterate config list to detect if the "freq" parameter is set */ +static bool arm_spe_is_set_freq (struct evsel *evsel) +{ +struct evsel_config_term *term; + +list_for_each_entry (term, &evsel->config_terms, list) { +if (term->type ==EVSEL__CONFIG_TERM_FREQ ) +return true; + } + +return false; +} +/* * arm_spe_find_cpus() returns a new cpu map, and the caller should invoke * perf_cpu_map__put() to release the map after use.
@@ -389,6 +402,14 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,return -EINVAL ; } opts->full_auxtrace = true; + +if (opts->user_freq !=UINT_MAX || +arm_spe_is_set_freq (evsel)) { +pr_err ("Arm SPE: Frequency is not supported. " +"Set period with -c option or PMU parameter (-e %s/period=NUM/).\n" , + evsel->pmu->name); +return -EINVAL ; + } } }
Signature · 1 line
2.25.1
Quoted 59 lines · Leo Yan
When users set the parameter '-F' to specify frequency for Arm SPE, the tool reports error:
perf record -F 1000 -e arm_spe_0// -- sleep 1
Error:
Invalid event (arm_spe_0//) in per-thread mode, enable system wide with '-a'.The output logs are confused and it does not give the correct reminding. Arm SPE does not support frequency setting given it adopts a statistical based approach.
Alternatively, Arm SPE supports setting period. This commit adds a for frequency setting. It reports error and reminds users to set period instead.
After:
perf record -F 1000 -e arm_spe_0// -- sleep 1
Arm SPE: Frequency is not supported. Set period with -c option or PMU parameter (-e arm_spe_0/period=NUM/).Signed-off-by Leo Yan <[email protected]>---
Changes from v1:
- Sugguested users for '-c' option or PMU parameter 'period' in the log (Namhyung)tools/perf/arch/arm64/util/arm-spe.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)tools/perf/arch/arm64/util/arm-spe.c +14
-0@@ -40,6 +40,19 @@ struct arm_spe_recording {bool *wrapped; }; +/* Iterate config list to detect if the "freq" parameter is set */ +static bool arm_spe_is_set_freq (struct evsel *evsel) +{ +struct evsel_config_term *term; + +list_for_each_entry (term, &evsel->config_terms, list) { +if (term->type ==EVSEL__CONFIG_TERM_FREQ ) +return true; + } + +return false; +} +/* * arm_spe_find_cpus() returns a new cpu map, and the caller should invoke * perf_cpu_map__put() to release the map after use. @@ -389,6 +402,14 @@ static int arm_spe_recording_options(struct auxtrace_record *itr,return -EINVAL ; } opts->full_auxtrace = true; +
tools/perf/arch/arm64/util/arm-spe.c static int arm_spe_recording_options(struct auxtrace_record *itr, · line 415
Quoted 10 lines
tools/perf/arch/arm64/util/arm-spe.c +7
-0+if (opts->user_freq !=UINT_MAX || +arm_spe_is_set_freq (evsel)) { +pr_err ("Arm SPE: Frequency is not supported. " +"Set period with -c option or PMU parameter (-e %s/period=NUM/).\n" , + evsel->pmu->name); +return -EINVAL ; + } } }
Quoted 8 lines · Leo Yan
When users set the parameter '-F' to specify frequency for Arm SPE, the tool reports error:
perf record -F 1000 -e arm_spe_0// -- sleep 1
Error:
Invalid event (arm_spe_0//) in per-thread mode, enable system wide with '-a'.[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung