summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/perf
diff options
context:
space:
mode:
authorMichael Neuling <mikey@neuling.org>2012-11-05 16:08:38 +0100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-01-10 07:02:04 +0100
commite13e895f8430d8c8b7a51478a4abd481bf9b64fb (patch)
tree3dfcd47583a9ef0ca626480268ca358bcc5eda8a /arch/powerpc/perf
parentpowerpc/perf: Fix finding overflowed PMC in interrupt (diff)
downloadlinux-e13e895f8430d8c8b7a51478a4abd481bf9b64fb.tar.xz
linux-e13e895f8430d8c8b7a51478a4abd481bf9b64fb.zip
powerpc/perf: Fix for PMCs not making progress
On POWER7 when we have really small counts left before overflow, we can take a PMU IRQ, but the PMC gets wound back to just before the overflow. If the kernel is setting the PMC to a value just before the overflow, we can get interrupted again without the PMC making any progress (ie another buggy overflow). In this case, we can end up making no forward progress, with the PMC interrupt returning us to the same count over and over. The below detects when we are making no forward progress (ie. delta = 0) and then increases the amount left before the overflow. This stops us from locking up. Signed-off-by: Michael Neuling <mikey@neuling.org> Reviewed-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> cc: Paul Mackerras <paulus@samba.org> cc: Anton Blanchard <anton@samba.org> cc: Linux PPC dev <linuxppc-dev@ozlabs.org> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'arch/powerpc/perf')
-rw-r--r--arch/powerpc/perf/core-book3s.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 53fc7b8e5d9a..89bd59365c07 100644
--- a/arch/powerpc/perf/core-book3s.c
+++ b/arch/powerpc/perf/core-book3s.c
@@ -1349,6 +1349,8 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
*/
val = 0;
left = local64_read(&event->hw.period_left) - delta;
+ if (delta == 0)
+ left++;
if (period) {
if (left <= 0) {
left += period;