* [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs
@ 2024-07-06 15:20 Leo Yan
2024-07-06 15:20 ` [PATCH v2 1/2] perf arm-spe: " Leo Yan
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Leo Yan @ 2024-07-06 15:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
John Garry, Will Deacon, Adrian Hunter, Jiri Olsa, Liang, Kan,
Suzuki K Poulose, Mike Leach, Kajol Jain, coresight,
linux-arm-kernel, linux-perf-users, linux-kernel
Cc: 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 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(-)
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/2] perf arm-spe: Support multiple Arm SPE PMUs
2024-07-06 15:20 [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Leo Yan
@ 2024-07-06 15:20 ` Leo Yan
2024-07-06 15:20 ` [PATCH v2 2/2] perf mem: Warn if memory events are not supported on all CPUs Leo Yan
2024-07-12 16:46 ` [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Namhyung Kim
2 siblings, 0 replies; 4+ messages in thread
From: Leo Yan @ 2024-07-06 15:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
John Garry, Will Deacon, Adrian Hunter, Jiri Olsa, Liang, Kan,
Suzuki K Poulose, Mike Leach, Kajol Jain, coresight,
linux-arm-kernel, linux-perf-users, linux-kernel
Cc: Leo Yan, James Clark
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_'.
Signed-off-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: James Clark <james.clark@arm.com>
---
tools/perf/arch/arm/util/pmu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c
index 8b7cb68ba1a8..b762f6395d16 100644
--- a/tools/perf/arch/arm/util/pmu.c
+++ b/tools/perf/arch/arm/util/pmu.c
@@ -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;
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 2/2] perf mem: Warn if memory events are not supported on all CPUs
2024-07-06 15:20 [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Leo Yan
2024-07-06 15:20 ` [PATCH v2 1/2] perf arm-spe: " Leo Yan
@ 2024-07-06 15:20 ` Leo Yan
2024-07-12 16:46 ` [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Namhyung Kim
2 siblings, 0 replies; 4+ messages in thread
From: Leo Yan @ 2024-07-06 15:20 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, Namhyung Kim, James Clark,
John Garry, Will Deacon, Adrian Hunter, Jiri Olsa, Liang, Kan,
Suzuki K Poulose, Mike Leach, Kajol Jain, coresight,
linux-arm-kernel, linux-perf-users, linux-kernel
Cc: Leo Yan, James Clark
It is possible that memory events are not supported on all CPUs.
Prints a warning by dumping the enabled CPU maps in this case.
Signed-off-by: Leo Yan <leo.yan@arm.com>
Reviewed-by: James Clark <james.clark@arm.com>
---
tools/perf/util/mem-events.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/tools/perf/util/mem-events.c b/tools/perf/util/mem-events.c
index 6dda47bb774f..8aff2ca8bbd5 100644
--- a/tools/perf/util/mem-events.c
+++ b/tools/perf/util/mem-events.c
@@ -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;
--
2.34.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs
2024-07-06 15:20 [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Leo Yan
2024-07-06 15:20 ` [PATCH v2 1/2] perf arm-spe: " Leo Yan
2024-07-06 15:20 ` [PATCH v2 2/2] perf mem: Warn if memory events are not supported on all CPUs Leo Yan
@ 2024-07-12 16:46 ` Namhyung Kim
2 siblings, 0 replies; 4+ messages in thread
From: Namhyung Kim @ 2024-07-12 16:46 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo, Ian Rogers, James Clark, John Garry,
Will Deacon, Adrian Hunter, Jiri Olsa, Liang, Kan,
Suzuki K Poulose, Mike Leach, Kajol Jain, coresight,
linux-arm-kernel, linux-perf-users, linux-kernel, Leo Yan
On Sat, 06 Jul 2024 16:20:33 +0100, Leo Yan wrote:
> 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)
>
> [...]
Applied to perf-tools-next, thanks!
Best regards,
Namhyung
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-07-12 16:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-06 15:20 [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Leo Yan
2024-07-06 15:20 ` [PATCH v2 1/2] perf arm-spe: " Leo Yan
2024-07-06 15:20 ` [PATCH v2 2/2] perf mem: Warn if memory events are not supported on all CPUs Leo Yan
2024-07-12 16:46 ` [PATCH v2 0/2] perf mem: Support multiple Arm SPE PMUs Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®