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
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Fix Committed
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.


perf stat -x, -o perf_golden.dat -r 10 -g -e
taskset 0x1C ../../common/cache

<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:

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