]> www.infradead.org Git - users/jedix/linux-maple.git/commit
sparc64: Fix a race condition when stopping performance counters
authorDave Aldridge <david.j.aldridge@oracle.com>
Fri, 3 Feb 2017 14:38:46 +0000 (06:38 -0800)
committerAllen Pais <allen.pais@oracle.com>
Wed, 17 May 2017 07:12:24 +0000 (12:42 +0530)
commit061243ff4b723adac4354d36d1ed0624b584c716
tree3a34bc2c1351f22bafe6abcd81b37a0840a90a44
parentb99f2d11f8dc2bb13c55513757d729d640fbea16
sparc64: Fix a race condition when stopping performance counters

This commit takes the fix as implemented in commit
e5b7619e1de2 and applies it to M8 devices. Original commit
message:

When stopping a performance counter that is close to overflowing,
there is a race condition that can occur between writing to the
PCRx register to stop the counter (and also clearing the PCRx.ov
bit at the same time) vs the performance counter overflowing and
setting the PCRx.ov bit in the PCRx register.
The result of this race condition is that we occasionally miss
a performance counter overflow interrupt, which in turn leads
to incorrect event counting.
This race condition has been observed when counting cpu cycles.
To fix this issue when stopping a performance counter,
we simply allow it to continue counting and overflow before
stopping it. This allows the performance counter overflow
interrupt to be generated and acted upon.

Orabug: 25441707

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/kernel/perf_event.c