Re: [PATCH] tools/perf/tests: Update event_groups test to use instructions as one of the sibling event for hw type
From: Athira Rajeev <hidden>
Date: 2025-01-20 08:23:45
Also in:
linux-perf-users
On 20 Jan 2025, at 12:00 PM, Ravi Bangoria [off-list ref] wrote: Hi Athira, On 10-Jan-25 3:16 PM, Athira Rajeev wrote:quoted
In some of the powerpc platforms, event group testcase fails as below: # perf test -v 'Event groups' 69: Event groups : --- start --- test child forked, pid 9765 Using CPUID 0x00820200 Using hv_24x7 for uncore pmu event 0x0 0x0, 0x0 0x0, 0x0 0x0: Fail 0x0 0x0, 0x0 0x0, 0x1 0x3: Pass The testcase creates various combinations of hw, sw and uncore PMU events and verify group creation succeeds or fails as expected. This tests one of the limitation in perf where it doesn't allow creating a group of events from different hw PMUs. The testcase starts a leader event and opens two sibling events. The combination the fails is three hardware events in a group. "0x0 0x0, 0x0 0x0, 0x0 0x0: Fail" Type zero and config zero which translates to PERF_TYPE_HARDWARE and PERF_COUNT_HW_CPU_CYCLE. There is event constraint in powerpc that events using same counter cannot be programmed in a group. Here there is one alternative event for cycles, hence one leader and only one sibling event can go in as a group.For power9, cycles seems to map to PM_CYC event: GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC); However, I don't see PM_CYC in power9_event_alternatives[]. Is PM_RUN_CYC and PM_CYC are same?
Hi Ravi
They are not the same. PM_CYC count irrespective of the run latch state (idle state)
whereas PM_RUN_CYC doesn’t do that.
This test runs fine in power9. The event code for PM_CYC is
EVENT(PM_CYC, 0x0001e)
Here it is not specifically meant to be run a particular counter and even if no alternative event is defined, it can pick available counters and go in as a group. But there are cases like other PMU (which is used in absence of platform specific PMU) , where alternative event is specified to run a particular counter.
Example: arch/powerpc/perf/generic-compat-pmu.c
EVENT(PM_CYC_ALT, 0x100f0)
EVENT(PM_CYC, 0x600f4)
In this case, we can have only two cycles events to go in a group. So with our testcase events, one leader and only one sibling event
can go in a group (checked other PMU’s to confirm two is possible). So added this fix to consider instructions as one of the sibling event.
Thanks
Athira
Thanks, Ravi