From: Michael Neuling <mikey@neuling.org>
To: Benjamin Herrenschmidt <^Cnh@kernel.crashing.org>
Cc: Linux PPC dev <linuxppc-dev@ozlabs.org>,
Michael Neuling <mikey@neuling.org>,
Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>,
Paul Mackerras <paulus@samba.org>,
Anton Blanchard <anton@samba.org>
Subject: [PATCH 2/2] powerpc/perf: Fix for PMCs not making progress
Date: Tue, 6 Nov 2012 12:08:38 +1100 [thread overview]
Message-ID: <1352164118-19450-2-git-send-email-mikey@neuling.org> (raw)
In-Reply-To: <1352164118-19450-1-git-send-email-mikey@neuling.org>
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>
---
arch/powerpc/perf/core-book3s.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/powerpc/perf/core-book3s.c b/arch/powerpc/perf/core-book3s.c
index 3575def..f1018c8 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;
--
1.7.9.5
next prev parent reply other threads:[~2012-11-06 1:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-08 1:07 [PATCH] Use pmc_overflow() to detect rolled back events Sukadev Bhattiprolu
2012-09-21 0:38 ` Sukadev Bhattiprolu
2012-11-06 1:08 ` [PATCH 1/2] powerpc/perf: Fix finding overflowed PMC in interrupt Michael Neuling
2012-11-06 1:08 ` Michael Neuling [this message]
2012-11-06 1:25 ` Anton Blanchard
2012-11-06 1:53 ` Michael Neuling
2012-11-06 1:53 ` Michael Neuling
2012-11-06 6:47 ` Anshuman Khandual
2012-11-06 10:19 ` Michael Neuling
2012-11-06 10:42 ` Anshuman Khandual
2012-12-22 1:07 ` Sukadev Bhattiprolu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352164118-19450-2-git-send-email-mikey@neuling.org \
--to=mikey@neuling.org \
--cc=^Cnh@kernel.crashing.org \
--cc=anton@samba.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=paulus@samba.org \
--cc=sukadev@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).