arm: perf: Disable IRQs when reading a counter
pmu->read() can be called with interrupts enabled and it ends up calling armv7pmu_read_counter() from armpmu_event_update(). The IRQ handler also calls armpmu_event_update(). If we get an interrupt after armv7pmu_read_counter() programs the counter selection register, but before reading the counter value, we can end up reading the wrong register value after the interrupt, because the handler re-programmed the counter selection register. Disable IRQs when reading the counter to prevent this from happening. Reported-by:Julien Thierry <julien.thierry@arm.com> Suggested-by:
Will Deacon <will@kernel.org> Signed-off-by:
Alexandru Elisei <alexandru.elisei@arm.com> Cc: Will Deacon <will.deacon@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Russell King <linux@armlinux.org.uk> Cc: stable@vger.kernel.org
Loading
Please register or sign in to comment