linux-stable/tools/perf
Kan Liang 2560454bf8 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:11:46 +02:00
..
Documentation perf bench sched pipe: Add -G/--cgroups option 2023-10-25 10:02:10 -07:00
arch tools/perf: Update tools's copy of mips syscall table 2023-11-22 10:57:47 -08:00
bench perf bench sched pipe: Add -G/--cgroups option 2023-10-25 10:02:10 -07: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: Remove UTF-8 characters from cmn.json 2024-01-25 15:45:23 -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: Fix 'perf script' tests on s390 2024-02-16 19:14:17 +01:00
trace tools headers: Update tools's copy of socket.h header 2023-11-22 10:57:47 -08:00
ui perf hists browser: Avoid potential NULL dereference 2023-10-12 10:01:56 -07:00
util perf pmu: Fix a potential memory leak in perf_pmu__lookup() 2024-03-26 18:18:39 -04:00
.gitignore
Build
CREDITS
MANIFEST tools perf: Add arm64 sysreg files to MANIFEST 2023-11-22 11:17:53 -08:00
Makefile
Makefile.config perf build: Disable BPF skeletons if clang version is < 12.0.1 2023-10-27 19:27:33 -07:00
Makefile.perf perf bpf: Clean up the generated/copied vmlinux.h 2024-03-26 18:18:31 -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 perf buildid-cache: Fix use of uninitialized value 2023-10-12 10:01:56 -07:00
builtin-buildid-list.c
builtin-c2c.c
builtin-config.c
builtin-daemon.c perf tools: Add missing else to cmd_daemon subcommand condition 2023-06-27 12:09:44 -07:00
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 perf symbol: Remove now unused symbol_conf.sort_by_name 2023-06-23 21:48:49 -07:00
builtin-kmem.c
builtin-kvm.c
builtin-kwork.c perf kwork: Fix a build error on 32-bit 2023-11-21 10:02:38 -08:00
builtin-list.c perf list: Fix JSON segfault by setting the used skip_duplicate_pmus callback 2023-12-05 11:16:00 -08:00
builtin-lock.c perf lock: Fix a memory leak on an error path 2023-10-12 10:01:57 -07: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:18:29 -04:00
builtin-report.c perf report: Fix spelling mistake "heirachy" -> "hierarchy" 2023-10-27 19:25:13 -07:00
builtin-sched.c libperf rc_check: Add RC_CHK_EQUAL 2023-10-25 13:37:22 -07:00
builtin-script.c perf: script: fix missing ',' for fields option 2023-10-17 12:40:51 -07:00
builtin-stat.c perf stat: Exit perf stat if parse groups fails 2024-01-25 15:45:21 -08:00
builtin-timechart.c
builtin-top.c perf top: Use evsel's cpus to replace user_requested_cpus 2024-04-03 15:11:46 +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 perf version: Add status of bpf skeletons 2023-09-18 16:46:15 -07:00
builtin.h
check-headers.sh perf tools: Add get_unaligned_leNN() 2023-10-17 12:40:02 -07:00
command-list.txt
design.txt
perf-archive.sh
perf-completion.sh perf shell completion: Support completion of metrics/metricgroups 2023-09-11 10:26:36 -03:00
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