perf mem: Support multiple Arm SPE PMUs
Leo Yan
reviewerv2 cover perf mem: Support multiple Arm SPE PMUs
This patch series is to enable multiple Arm SPE PMUs.
The patch 01 is to enable multiple Arm SPE PMUs. The second patch is to print out warning if not all CPUs support memory events, this can give users a hint that the memory profiling is absent on some CPUs.
Changes from v1:
- Changed to use strstarts() (Ian Rogers)
- Changed to use 'arm_spe_' for searching Arm SPE events (Namhyung Kim)
Leo Yan (2):
perf arm-spe: Support multiple Arm SPE PMUs
perf mem: Warn if memory events are not supported on all CPUs
tools/perf/arch/arm/util/pmu.c | 2 +- tools/perf/util/mem-events.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-)
Signature · 1 line
2.34.1
Leo Yan
reviewerPATCH v2 1/2 perf arm-spe: Support multiple Arm SPE PMUs
A platform can have more than one Arm SPE PMU. For example, a system with multiple clusters may have each cluster enabled with its own Arm SPE instance. In such case, the PMU devices will be named 'arm_spe_0', 'arm_spe_1', and so on.
Currently, the tool only supports 'arm_spe_0'. This commit extends support to multiple Arm SPE PMUs by detecting the substring 'arm_spe_'.
--- tools/perf/arch/arm/util/pmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/arch/arm/util/pmu.c +1 -1
@@ -27,7 +27,7 @@ void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) pmu->selectable = true; pmu->is_uncore = false; pmu->perf_event_attr_init_default = arm_spe_pmu_default_config; -if (!strcmp (pmu->name,"arm_spe_0" )) +if (strstarts (pmu->name,"arm_spe_" )) pmu->mem_events = perf_mem_events_arm; }else if (strstarts (pmu->name,HISI_PTT_PMU_NAME )) { pmu->selectable = true;
Signature · 1 line
2.34.1
Leo Yan
reviewerPATCH v2 2/2 perf mem: Warn if memory events are not supported on all CPUs
In reply to Leo YanIt is possible that memory events are not supported on all CPUs.
Prints a warning by dumping the enabled CPU maps in this case.
--- tools/perf/util/mem-events.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
tools/perf/util/mem-events.c +14 -0
@@ -8,6 +8,7 @@#include <unistd.h> #include <api/fs/fs.h> #include <linux/kernel.h> +#include "cpumap.h" #include "map_symbol.h" #include "mem-events.h" #include "mem-info.h"
@@ -242,6 +243,7 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr)int i = *argv_nr;const char *s;char *copy; +struct perf_cpu_map *cpu_map =NULL ;while ((pmu =perf_pmus__scan_mem (pmu)) !=NULL ) {for (int j =0 ; j <PERF_MEM_EVENTS__MAX ; j++) {
@@ -266,7 +268,19 @@ int perf_mem_events__record_args(const char **rec_argv, int *argv_nr) rec_argv[i++] ="-e" ; rec_argv[i++] = copy; + + cpu_map =perf_cpu_map__merge (cpu_map, pmu->cpus); + } + } + +if (cpu_map) { +if (!perf_cpu_map__equal (cpu_map,cpu_map__online ())) { +char buf[200 ]; + +cpu_map__snprint (cpu_map, buf,sizeof (buf)); +pr_warning ("Memory events are enabled on a subset of CPUs: %s\n" , buf); } +perf_cpu_map__put (cpu_map); } *argv_nr = i;
Signature · 1 line
2.34.1
Quoted 11 lines · Leo Yan
This patch series is to enable multiple Arm SPE PMUs.
The patch 01 is to enable multiple Arm SPE PMUs. The second patch is to print out warning if not all CPUs support memory events, this can give users a hint that the memory profiling is absent on some CPUs.
Changes from v1:
- Changed to usestrstarts()(Ian Rogers)
- Changed to use 'arm_spe_' for searching Arm SPE events (Namhyung Kim)[...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung