[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190529094659.GK2623@hirez.programming.kicks-ass.net>
Date: Wed, 29 May 2019 11:46:59 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Raphael Gault <raphael.gault@....com>
Cc: linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
mingo@...hat.com, catalin.marinas@....com, will.deacon@....com,
acme@...nel.org, mark.rutland@....com
Subject: Re: [RFC 4/7] arm64: pmu: Add function implementation to update
event index in userpage.
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?
> +}
Powered by blists - more mailing lists