From: Don Zickus <dzickus@redhat.com>
To: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
Cyrill Gorcunov <gorcunov@gmail.com>,
Lin Ming <ming.m.lin@intel.com>,
"fweisbec@gmail.com" <fweisbec@gmail.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"Huang, Ying" <ying.huang@intel.com>,
Yinghai Lu <yinghai@kernel.org>, Andi Kleen <andi@firstfloor.org>
Subject: Re: [PATCH -v3] perf, x86: try to handle unknown nmis with running perfctrs
Date: Fri, 27 Aug 2010 14:57:44 -0400 [thread overview]
Message-ID: <20100827185744.GV4879@redhat.com> (raw)
In-Reply-To: <20100827081038.GF22783@erda.amd.com>
On Fri, Aug 27, 2010 at 10:10:38AM +0200, Robert Richter wrote:
> >
> > inc_irq_stat(apic_perf_irqs);
> > ack = status;
> > + intel_pmu_ack_status(ack);
>
> I would slightly change the patch:
>
> There is no need for the ack variable anymore, you could directly work
> with the status.
>
> I would call intel_pmu_ack_status() as close as possible after the
> intel_pmu_get_status(), which is after 'again:'.
>
Here is another version of the patch, which uses Robert's suggestion of
removing the ack variable
Cheers,
Don
--
From: Don Zickus <dzickus@redhat.com>
Date: Fri, 27 Aug 2010 14:43:03 -0400
Subject: [PATCH] [x86] perf: fix accidentally ack'ing a second event on intel perf counter
During testing of a patch to stop having the perf subsytem swallow nmis,
it was uncovered that Nehalem boxes were randomly getting unknown nmis
when using the perf tool.
Moving the ack'ing of the PMI closer to when we get the status allows
the hardware to properly re-set the PMU bit signaling another PMI was
triggered during the processing of the first PMI. This allows the new
logic for dealing with the shortcomings of multiple PMIs to handle the
extra NMI by 'eat'ing it later.
Now one can wonder why are we getting a second PMI when we disable all
the PMUs in the begining of the NMI handler to prevent such a case, for
that I do not know. But I know the fix below helps deal with this quirk.
Tested on multiple Nehalems where the problem was occuring. With the
patch, the code now loops a second time to handle the second PMI (whereas
before it was not).
Signed-off-by: Don Zickus <dzickus@redhat.com>
---
arch/x86/kernel/cpu/perf_event_intel.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index 4539b4b..ee05c90 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -712,7 +712,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
struct perf_sample_data data;
struct cpu_hw_events *cpuc;
int bit, loops;
- u64 ack, status;
+ u64 status;
int handled = 0;
perf_sample_data_init(&data, 0);
@@ -729,6 +729,7 @@ static int intel_pmu_handle_irq(struct pt_regs *regs)
loops = 0;
again:
+ intel_pmu_ack_status(status);
if (++loops > 100) {
WARN_ONCE(1, "perfevents: irq loop stuck!\n");
perf_event_print_debug();
@@ -737,7 +738,6 @@ again:
}
inc_irq_stat(apic_perf_irqs);
- ack = status;
intel_pmu_lbr_read();
@@ -766,8 +766,6 @@ again:
x86_pmu_stop(event);
}
- intel_pmu_ack_status(ack);
-
/*
* Repeat if there is more work to be done:
*/
--
1.7.2.1
next prev parent reply other threads:[~2010-08-27 18:58 UTC|newest]
Thread overview: 70+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-20 15:05 [PATCH -v3] perf, x86: try to handle unknown nmis with running perfctrs Don Zickus
2010-08-20 15:25 ` Ingo Molnar
2010-08-23 8:53 ` Ingo Molnar
2010-08-24 16:22 ` Cyrill Gorcunov
2010-08-24 17:09 ` Robert Richter
2010-08-24 17:20 ` Cyrill Gorcunov
2010-08-24 17:21 ` Cyrill Gorcunov
2010-08-24 17:15 ` Robert Richter
2010-08-24 17:28 ` Cyrill Gorcunov
2010-08-24 18:46 ` Don Zickus
2010-08-24 18:54 ` Cyrill Gorcunov
2010-08-24 19:52 ` Cyrill Gorcunov
2010-08-24 20:27 ` Don Zickus
2010-08-24 20:40 ` Cyrill Gorcunov
2010-08-25 23:52 ` Frederic Weisbecker
2010-08-26 9:11 ` Cyrill Gorcunov
2010-08-25 10:20 ` Robert Richter
2010-08-26 21:14 ` Don Zickus
2010-08-27 7:51 ` Robert Richter
2010-08-27 13:39 ` Don Zickus
2010-08-27 8:10 ` Robert Richter
2010-08-27 13:44 ` Don Zickus
2010-08-27 14:05 ` Robert Richter
2010-08-27 15:05 ` Don Zickus
2010-08-27 15:48 ` Robert Richter
2010-08-27 18:57 ` Don Zickus [this message]
2010-08-27 19:00 ` Yinghai Lu
2010-08-27 19:33 ` Robert Richter
2010-08-25 9:48 ` Robert Richter
2010-08-25 10:41 ` Ingo Molnar
2010-08-25 11:00 ` Ingo Molnar
2010-08-25 20:11 ` Don Zickus
2010-08-25 20:24 ` Cyrill Gorcunov
2010-08-25 21:20 ` Don Zickus
2010-08-25 21:36 ` Cyrill Gorcunov
2010-08-26 9:00 ` Robert Richter
2010-08-26 9:18 ` Cyrill Gorcunov
2010-08-26 14:31 ` Don Zickus
2010-08-26 15:22 ` Don Zickus
2010-08-26 15:34 ` Cyrill Gorcunov
2010-08-26 16:40 ` Don Zickus
2010-08-26 18:02 ` Cyrill Gorcunov
2010-08-27 7:57 ` Robert Richter
2010-08-27 8:11 ` Peter Zijlstra
2010-08-27 8:31 ` Robert Richter
2010-08-25 11:02 ` Robert Richter
2010-08-25 11:19 ` Ingo Molnar
2010-08-20 23:31 ` Don Zickus
-- strict thread matches above, loose matches on Subject: below --
2010-08-04 15:18 A question of perf NMI handler Cyrill Gorcunov
2010-08-04 15:50 ` Don Zickus
2010-08-04 16:10 ` Cyrill Gorcunov
2010-08-04 16:20 ` Don Zickus
2010-08-04 16:39 ` Cyrill Gorcunov
2010-08-04 18:48 ` Robert Richter
2010-08-04 19:26 ` Cyrill Gorcunov
2010-08-06 6:52 ` Robert Richter
2010-08-06 14:21 ` Don Zickus
2010-08-09 19:48 ` [PATCH] perf, x86: try to handle unknown nmis with running perfctrs Robert Richter
2010-08-17 15:22 ` [PATCH -v3] " Robert Richter
2010-08-17 16:17 ` Cyrill Gorcunov
2010-08-19 10:45 ` Peter Zijlstra
2010-08-19 12:39 ` Robert Richter
2010-08-19 14:12 ` Don Zickus
2010-08-19 14:27 ` Peter Zijlstra
2010-08-19 15:20 ` Don Zickus
2010-08-19 17:43 ` Cyrill Gorcunov
2010-08-19 17:53 ` Peter Zijlstra
2010-08-19 21:58 ` Don Zickus
2010-08-20 8:50 ` Peter Zijlstra
2010-08-20 1:50 ` Don Zickus
2010-08-20 8:16 ` Ingo Molnar
2010-08-20 10:04 ` Peter Zijlstra
2010-08-20 10:30 ` Cyrill Gorcunov
2010-08-20 12:39 ` Don Zickus
2010-08-20 13:27 ` Ingo Molnar
2010-08-20 13:51 ` Don Zickus
2010-08-20 14:17 ` Ingo Molnar
2010-08-20 20:45 ` Cyrill Gorcunov
2010-08-24 21:48 ` Don Zickus
2010-08-20 8:36 ` Robert Richter
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=20100827185744.GV4879@redhat.com \
--to=dzickus@redhat.com \
--cc=andi@firstfloor.org \
--cc=fweisbec@gmail.com \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.m.lin@intel.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=ying.huang@intel.com \
--cc=yinghai@kernel.org \
/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).