linux/tools/perf
Zide Chen 0824af00a8 perf topdown: Don't require config1==0 for a slots event
arch_is_topdown_slots() requires config1 == 0, so it misidentified
"cpu/slots,metrics_clear=1/" as not being the slots event, and an
additional slots event gets inserted, which fails event scheduling
since the group now needs two fixed counter 3.

  $ perf stat -e "{cpu/slots,metrics_clear=1/,cpu/topdown-retiring/}" -- sleep 1
  WARNING: events were regrouped to match PMUs
       <not counted>      slots
     <not supported>      cpu/slots,metrics_clear=1/
       <not counted>      cpu/topdown-retiring/

Drop the config1 == 0 check from arch_is_topdown_slots(). This is
safe: config1 has no bearing on the event's identifying config value
(TOPDOWN_SLOTS, 0x0400).

The attr.type == PERF_TYPE_RAW check is what actually matters: only the
core PMU is registered with PERF_TYPE_RAW, and on x86, 0x400 is
guaranteed to be slots event on core CPU.

arch_is_topdown_metrics() keeps its own config1 == 0 check, since
genuine metrics events have no "metrics_clear" and config1 remains 0.

Add a test verifying that an explicit "slots,metrics_clear=1" event in
a group does not trigger an extra slots event injection.

Fixes: 5b546de9cc ("perf topdown: Use attribute to see an event is a topdown metic or slots")
Reviewed-by: Dapeng Mi <dapeng1.mi@linux.intel.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Zide Chen <zide.chen@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
[ Add missing stdio.h and string.h as noticed by Sashiko ]
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2026-09-18 17:18:25 -03:00
..
arch perf topdown: Don't require config1==0 for a slots event 2026-09-18 17:18:25 -03:00
bench perf bench messaging: Fix the formatting issue when printing. 2026-09-17 12:27:34 -03:00
check-header_ignore_hunks/lib
dlfilters
Documentation perf regs: Support x86 SIMD registers sampling 2026-09-14 15:34:05 -03:00
include/perf
jvmti
pmu-events perf jevents: Add mesh bandwidth saturation for CWF, EMR, GRR, SNR, SPR, SRF 2026-09-13 21:43:20 -03:00
python perf python: Fix ilist TreeNode string type drift 2026-09-13 18:39:12 -03:00
scripts tools: Port perf ui from GTK 2 to GTK 4 2026-09-09 17:00:04 -03:00
tests perf record: Fix unhandled POLLHUP on non_perf_event descriptors 2026-09-17 12:27:34 -03:00
trace perf trace: Introduce kernel symbol beautifier for virtual addresses 2026-09-04 18:14:01 -03:00
ui perf annotate-data: Convert type histogram to hashmap 2026-09-14 15:58:37 -03:00
util perf evsel: Find process with busy PMUs for EBUSY 2026-09-17 12:27:34 -03:00
.clang-format perf tool: Align structs in arrays in .clang-format 2026-09-09 17:03:35 -03:00
.gitignore
bpf_skel.mak
Build
builtin-annotate.c tools: Port perf ui from GTK 2 to GTK 4 2026-09-09 17:00:04 -03:00
builtin-bench.c
builtin-buildid-cache.c
builtin-buildid-list.c
builtin-c2c.c perf hist: Remove keysym.h include from hist.h 2026-09-08 17:50:37 -03:00
builtin-check.c
builtin-config.c perf tool: Tidy up util/cache.h header file users 2026-09-08 17:50:28 -03:00
builtin-daemon.c
builtin-data.c
builtin-diff.c
builtin-evlist.c
builtin-ftrace.c perf ftrace latency: Do not read trace files when BPF is used 2026-09-08 18:04:33 -03:00
builtin-help.c perf tool: Tidy up util/cache.h header file users 2026-09-08 17:50:28 -03:00
builtin-inject.c perf python: Use evsel in sample in pyrf_event 2026-06-30 10:17:12 -07:00
builtin-kallsyms.c
builtin-kmem.c
builtin-kvm.c perf hist: Remove keysym.h include from hist.h 2026-09-08 17:50:37 -03:00
builtin-kwork.c perf evlist: Add reference count checking 2026-06-30 10:17:11 -07:00
builtin-list.c perf list: Avoid repeated strlen() when escaping JSON strings 2026-09-13 18:44:37 -03:00
builtin-lock.c perf evlist: Add reference count checking 2026-06-30 10:17:11 -07:00
builtin-mem.c
builtin-probe.c
builtin-record.c perf record: Fix unhandled POLLHUP on non_perf_event descriptors 2026-09-17 12:27:34 -03:00
builtin-report.c tools: Port perf ui from GTK 2 to GTK 4 2026-09-09 17:00:04 -03:00
builtin-sched.c perf sched latency: Add histogram and time interval options 2026-08-07 10:56:23 -07:00
builtin-script.c perf regs: Enable dumping of SIMD registers 2026-09-14 15:34:43 -03:00
builtin-stat.c perf stat: Avoid uninitialized memory read on error 2026-09-09 08:10:17 -03:00
builtin-timechart.c perf timechart: Fix memory leaks in draw_wakeups() 2026-06-30 17:04:51 -07:00
builtin-top.c perf hist: Remove keysym.h include from hist.h 2026-09-08 17:50:37 -03:00
builtin-trace.c perf trace: Add upper bound checks for augmented BTF struct printing 2026-09-08 18:42:37 -03:00
builtin-version.c
builtin.h perf tool: Move usage strings and functions to perf.c 2026-09-08 17:50:32 -03:00
check-headers.sh
CREDITS
design.txt
Makefile perf tests: Improvements to build-test performance 2026-09-09 17:00:36 -03:00
Makefile.config perf tools: make the GTK4 report browser actually loadable at runtime 2026-09-09 17:00:36 -03:00
Makefile.perf tools: Port perf ui from GTK 2 to GTK 4 2026-09-09 17:00:04 -03:00
MANIFEST
perf-archive.sh
perf-completion.sh
perf-iostat.sh
perf-read-vdso.c
perf-sys.h
perf.c perf tool: Add fallback stubs for missing dependencies 2026-09-08 17:50:34 -03:00
perf.h