* Leader sampling and topdown events
@ 2025-04-07 18:23 Ian Rogers
2025-04-07 18:51 ` Liang, Kan
0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2025-04-07 18:23 UTC (permalink / raw)
To: Liang, Kan, Dapeng Mi; +Cc: linux-perf-users, Weilin Wang
Hi,
I'm trying to understand why the following succeeds:
```
$ perf record -e '{slots,instructions,topdown-retiring}:S' -a sleep 0.1
WARNING: events were regrouped to match PMUs
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 3.077 MB perf.data (496 samples) ]
```
As per the test case in:
https://lore.kernel.org/all/20240913084712.13861-6-dapeng1.mi@linux.intel.com/
But without the instructions event it fails:
```
$ perf record -e '{slots,topdown-retiring}:S' -a sleep 0.1
WARNING: events were regrouped to match PMUs
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument)
for event (cpu_core/topdown-retiring/).
"dmesg | grep -i perf" may provide additional information.
```
With the (not merged) patch:
https://lore.kernel.org/lkml/20250402201549.4090305-6-irogers@google.com/
The groups being programmed are:
```
$ perf record -v -e '{slots,topdown-retiring}:S' -a sleep 0.1
Using CPUID GenuineIntel-6-B7-1
slots -> cpu_core/slots/
topdown-retiring -> cpu_atom/topdown-retiring/
topdown-retiring -> cpu_core/topdown-retiring/
WARNING: events were regrouped to match PMUs
evlist after sorting/fixing:
'cpu_atom/topdown-retiring/,{cpu_core/slots/,cpu_core/topdown-retiring/}'
DEBUGINFOD_URLS=
nr_cblocks: 0
affinity: SYS
mmap flush: 1
comp level: 0
Error:
The sys_perf_event_open() syscall returned with 22 (Invalid argument)
for event (cpu_core/topdown-retiring/).
"dmesg | grep -i perf" may provide additional information.
```
Given we only want to read the topdown-retiring event with leader
sampling, what's the significance of the instructions event? `perf
stat` doesn't require it.
Thanks,
Ian
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Leader sampling and topdown events
2025-04-07 18:23 Leader sampling and topdown events Ian Rogers
@ 2025-04-07 18:51 ` Liang, Kan
0 siblings, 0 replies; 2+ messages in thread
From: Liang, Kan @ 2025-04-07 18:51 UTC (permalink / raw)
To: Ian Rogers, Dapeng Mi; +Cc: linux-perf-users, Weilin Wang
On 2025-04-07 2:23 p.m., Ian Rogers wrote:
> Hi,
>
> I'm trying to understand why the following succeeds:
> ```
> $ perf record -e '{slots,instructions,topdown-retiring}:S' -a sleep 0.1
> WARNING: events were regrouped to match PMUs
> [ perf record: Woken up 1 times to write data ]
> [ perf record: Captured and wrote 3.077 MB perf.data (496 samples) ]
> ```
> As per the test case in:
> https://lore.kernel.org/all/20240913084712.13861-6-dapeng1.mi@linux.intel.com/
> But without the instructions event it fails:
> ```
> $ perf record -e '{slots,topdown-retiring}:S' -a sleep 0.1
> WARNING: events were regrouped to match PMUs
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument)
> for event (cpu_core/topdown-retiring/).
> "dmesg | grep -i perf" may provide additional information.
> ```
> With the (not merged) patch:
> https://lore.kernel.org/lkml/20250402201549.4090305-6-irogers@google.com/
> The groups being programmed are:
> ```
> $ perf record -v -e '{slots,topdown-retiring}:S' -a sleep 0.1
> Using CPUID GenuineIntel-6-B7-1
> slots -> cpu_core/slots/
> topdown-retiring -> cpu_atom/topdown-retiring/
> topdown-retiring -> cpu_core/topdown-retiring/
> WARNING: events were regrouped to match PMUs
> evlist after sorting/fixing:
> 'cpu_atom/topdown-retiring/,{cpu_core/slots/,cpu_core/topdown-retiring/}'
> DEBUGINFOD_URLS=
> nr_cblocks: 0
> affinity: SYS
> mmap flush: 1
> comp level: 0
> Error:
> The sys_perf_event_open() syscall returned with 22 (Invalid argument)
> for event (cpu_core/topdown-retiring/).
> "dmesg | grep -i perf" may provide additional information.
> ```
> Given we only want to read the topdown-retiring event with leader
> sampling, what's the significance of the instructions event? `perf
> stat` doesn't require it.
>
For p-core, the PERF_METRICS counter is not a regular counter. It's a
combination of fractions for topdown events. The slots event is required
to calculate the topdown events. The PERF_METRICS and slots must be
synchronized (start from 0 at the same time). So we cannot use the slots
for sampling. There must be an auxiliary event for sampling, e.g.,
instructions in this case.
The slots must be the first event of a topdown group. So the auxiliary
event needs to be the second event.
Thanks,
Kan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-04-07 18:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-07 18:23 Leader sampling and topdown events Ian Rogers
2025-04-07 18:51 ` Liang, Kan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.