mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 05:13:18 +00:00
perf mem: Warn if memory events are not supported on all CPUs
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@linaro.org> Cc: Suzuki K Poulose <suzuki.poulose@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mike Leach <mike.leach@linaro.org> Cc: Kajol Jain <kjain@linux.ibm.com> Cc: John Garry <john.g.garry@oracle.com> Cc: linux-arm-kernel@lists.infradead.org Cc: coresight@lists.linaro.org Link: https://lore.kernel.org/r/20240706152035.86983-3-leo.yan@arm.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
e6b4da6759
commit
14b0fffa25
@ -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,9 +268,21 @@ 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;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user