On 29/05/2019 11:46, Raphael Gault wrote:
Hi Peter,
On 5/29/19 10:46 AM, Peter Zijlstra wrote:
On Tue, May 28, 2019 at 04:03:17PM +0100, Raphael Gault wrote:
+static int armv8pmu_access_event_idx(struct perf_event *event)
+{
+ÂÂÂ if (!(event->hw.flags & ARMPMU_EL0_RD_CNTR))
+ÂÂÂÂÂÂÂ return 0;
+
+ÂÂÂ /*
+ÂÂÂÂ * We remap the cycle counter index to 32 to
+ÂÂÂÂ * match the offset applied to the rest of
+ÂÂÂÂ * the counter indeces.
+ÂÂÂÂ */
+ÂÂÂ if (event->hw.idx == ARMV8_IDX_CYCLE_COUNTER)
+ÂÂÂÂÂÂÂ return 32;
+
+ÂÂÂ return event->hw.idx;
Is there a guarantee event->hw.idx is never 0? Or should you, just like
x86, use +1 here?
You are right, I should use +1 here. Thanks for pointing that out.
Isn't that already the case though, since we reserve index 0 for the cycle counter? I'm looking at ARMV8_IDX_TO_COUNTER() here...
Robin.