linux-stable/tools/perf
Kan Liang 11b4dc6494 perf top: Use evsel's cpus to replace user_requested_cpus
commit 5fa695e7da upstream.

perf top errors out on a hybrid machine
 $perf top

 Error:
 The cycles:P event is not supported.

The perf top expects that the "cycles" is collected on all CPUs in the
system. But for hybrid there is no single "cycles" event which can cover
all CPUs. Perf has to split it into two cycles events, e.g.,
cpu_core/cycles/ and cpu_atom/cycles/. Each event has its own CPU mask.
If a event is opened on the unsupported CPU. The open fails. That's the
reason of the above error out.

Perf should only open the cycles event on the corresponding CPU. The
commit ef91871c96 ("perf evlist: Propagate user CPU maps intersecting
core PMU maps") intersect the requested CPU map with the CPU map of the
PMU. Use the evsel's cpus to replace user_requested_cpus.

The evlist's threads are also propagated to the evsel's threads in
__perf_evlist__propagate_maps(). For a system-wide event, perf appends
a dummy event and assign it to the evsel's threads. For a per-thread
event, the evlist's thread_map is assigned to the evsel's threads. The
same as the other tools, e.g., perf record, using the evsel's threads
when opening an event.

Reported-by: Arnaldo Carvalho de Melo <acme@kernel.org>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Kan Liang <kan.liang@linux.intel.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Hector Martin <marcan@marcan.st>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Closes: https://lore.kernel.org/linux-perf-users/ZXNnDrGKXbEELMXV@kernel.org/
Link: https://lore.kernel.org/r/20231214144612.1092028-1-kan.liang@linux.intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-04-03 15:28:53 +02:00
..
Documentation perf kwork: Add the supported subcommands to the document 2023-11-20 11:59:25 +01:00
arch tools headers UAPI: Sync files changed by new fchmodat2 and map_shadow_stack syscalls with the kernel sources 2023-09-13 08:24:51 -03:00
bench perf bench sched-seccomp-notify: Use the tools copy of seccomp.h UAPI 2023-09-13 08:49:00 -03:00
dlfilters perf dlfilter: Add a test for object_code() 2023-09-30 00:09:06 -07:00
include/perf perf dlfilter: Add al_cleanup() 2023-08-15 16:41:49 -03:00
jvmti
pmu-events perf vendor events arm64 AmpereOne: Rename BPU_FLUSH_MEM_FAULT to GPC_FLUSH_MEM_FAULT 2024-01-25 15:35:51 -08:00
python
scripts perf scripts python gecko: Launch the profiler UI on the default browser with the appropriate URL 2023-08-24 14:41:49 -03:00
tests perf test record user-regs: Fix mask for vg register 2024-01-25 15:35:51 -08:00
trace perf tools changes for v6.6: 2023-09-09 20:06:17 -07:00
ui perf tui slang: Tidy casts 2023-08-25 10:24:55 -03:00
util perf pmu: Fix a potential memory leak in perf_pmu__lookup() 2024-03-26 18:19:52 -04:00
.gitignore
Build
CREDITS
MANIFEST
Makefile
Makefile.config perf parse-events: Remove BPF event support 2023-08-15 16:41:48 -03:00
Makefile.perf perf bpf: Clean up the generated/copied vmlinux.h 2024-03-26 18:19:45 -04:00
builtin-annotate.c
builtin-bench.c perf tools changes for v6.6: 2023-09-09 20:06:17 -07:00
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c
builtin-config.c
builtin-daemon.c
builtin-data.c
builtin-diff.c perf diff: Replaces some ',' as separator with the more usual ';' 2023-07-20 11:43:45 -03:00
builtin-evlist.c
builtin-ftrace.c
builtin-help.c
builtin-inject.c
builtin-kallsyms.c
builtin-kmem.c
builtin-kvm.c
builtin-kwork.c perf kwork: Set ordered_events to true in 'struct perf_tool' 2023-11-20 11:59:25 +01:00
builtin-list.c perf list: Fix JSON segfault by setting the used skip_duplicate_pmus callback 2023-12-13 18:45:34 +01:00
builtin-lock.c tools/perf: Update call stack check in builtin-lock.c 2023-11-20 11:59:26 +01:00
builtin-mem.c
builtin-probe.c
builtin-record.c perf record: Check conflict between '--timestamp-filename' option and pipe mode before recording 2024-03-26 18:19:43 -04:00
builtin-report.c
builtin-sched.c
builtin-script.c perf script: Print "cgroup" field on the same line as "comm" 2023-08-08 11:21:11 -03:00
builtin-stat.c perf stat: Exit perf stat if parse groups fails 2024-01-25 15:35:51 -08:00
builtin-timechart.c
builtin-top.c perf top: Use evsel's cpus to replace user_requested_cpus 2024-04-03 15:28:53 +02:00
builtin-trace.c perf trace: Use heuristic when deciding if a syscall tracepoint "const char *" field is really a string 2023-08-18 16:33:28 -03:00
builtin-version.c
builtin.h
check-headers.sh tools headers UAPI: Copy seccomp.h to be able to build 'perf bench' in older systems 2023-09-13 08:48:48 -03:00
command-list.txt
design.txt
perf-archive.sh
perf-completion.sh
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf parse-events: Remove BPF event support 2023-08-15 16:41:48 -03:00
perf.h