BLS-460: Perf group counting requires 'cpu_cycles' event as the first event in the event list specified to the perf tool.

Bug #1110634 reported by Ryan Harkin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
linaro-landing-team-arm
Fix Committed
Medium
Robin Randhawa

Bug Description

Issue with grouped counters found. If we specify the events with the
string approach (i.e. specifying the PMU by name), then the first event
has to be cpu-cycles. Otherwise this does not work.

E.g:

perf stat -x, -o perf_golden.dat -r 10 -g -e
ARMv7_Cortex_A7/config=0xFF,name=a7_cpu_cycles/,ARMv7_Cortex_A7/config=0x08,name=a7_instructions/,ARMv7_Cortex_A7/config=0x04,name=a7_cache_references/,ARMv7_Cortex_A7/config=0x03,name=a7_cache_misses/,ARMv7_Cortex_A7/config=0x0C,name=a7_branch_instructions/,ARMv7_Cortex_A7/config=0x10,name=a7_branch_misses/
taskset 0x1C ../../common/cache

3628292479,a7_cpu_cycles,0.32%
1415470141,a7_instructions,0.00%
741187897,a7_cache_references,0.00%
67686042,a7_cache_misses,0.00%
134857500,a7_branch_instructions,0.00%
<not supported>,a7_branch_misses

Cortex-A7 has 4 counters, so we get values for 'a7_instructions',
'a7_cache_references', 'a7_cache_references' and
'a7_branch_instructions'. For 'a7_branch_misses' we receive <not
supported> which is the expected behaviour.

If I do not specify 'a7_cpu_cycles' as the first event, the behaviour is
different. All events return with '<not supported>' or '0'.

The behaviour is the same on Cortex-A15 (with 6 + 1 counters obviously).

Ryan Harkin (ryanharkin)
information type: Proprietary → Public
Revision history for this message
Sudeep Holla (sudeep.holla) wrote :

When validating the group events, each event is checked for its state
and availability. The group leader's state is set to PERF_EVENT_STATE_OFF
while its siblings set to PERF_EVENT_STATE_INACTIVE.

Currently since the event state needs to be greater than
PERF_EVENT_STATE_OFF, the group leader is skipped while checking for the
availabilty. This results in allowing an extra event than the actual
available counters.

The fix is to make sure the event state is checked properly so that the group
leader event is also considered for availabilty check.

Will Deacon has posted the patch to A/LKML, follow the same for more updates:
https://lkml.org/lkml/2013/3/28/412

Ryan Harkin (ryanharkin)
Changed in linaro-landing-team-arm:
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Sudeep Holla (sudeep.holla) wrote :

This fix is included in v3.9, so this can be closed.

Revision history for this message
Ryan Harkin (ryanharkin) wrote :

Thanks, Sudeep, I've marked it as fixed, so it'll get added to our next release note.

Changed in linaro-landing-team-arm:
milestone: none → 2013.05
status: Confirmed → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers