Skip to content
Commit a12d305b authored by Alexandru Elisei's avatar Alexandru Elisei Committed by Alexandru Elisei
Browse files

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: default avatarJulien Thierry <julien.thierry@arm.com>
Suggested-by: default avatarWill Deacon <will@kernel.org>
Signed-off-by: Alexandru Elisei's avatarAlexandru 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
parent 2ef96a5b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment