From: Jason Wessel <jason.wessel@windriver.com>
To: Don Zickus <dzickus@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@elte.hu>,
Robert Richter <robert.richter@amd.com>,
ying.huang@intel.com, Andi Kleen <andi@firstfloor.org>,
LKML <linux-kernel@vger.kernel.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
gorcunov@gmail.com
Subject: Re: [V2 PATCH 0/6] x86, NMI: give NMI handler a face-lift
Date: Thu, 18 Nov 2010 09:18:19 -0600 [thread overview]
Message-ID: <4CE543BB.2010903@windriver.com> (raw)
In-Reply-To: <20101118143232.GC18100@redhat.com>
On 11/18/2010 08:32 AM, Don Zickus wrote:
> On Thu, Nov 18, 2010 at 02:17:12PM +0100, Peter Zijlstra wrote:
>> On Thu, 2010-11-18 at 06:47 -0600, Jason Wessel wrote:
>>> More specifically
>>> when another subsystem injects an NMI event the perf NMI code returns
>>> NOTIFY_STOP.
>> Not unconditionally, right? We only do so when the previous NMI was from
>> the PMU and nobody claimed this one (NOTIFY_STOP from DIE_NMIUNKNOWN).
>>
>> Or are you hitting the other one, where !handled but pmu_nmi.handled >
>> 1 ?
>
> On my Nehalem box, the kgdb tests work fine, no issues there. On my P4
> box, the p4 handler really thinks the NMIs are from the perf counter and
> returns handled==1 and starves the kgdb tests.
>
> I haven't gotten around to checking Jason's kvm setup to determine which
> handler his setup is calling.
>
> Jason, could you snip part of your dmesg log that shows the output with
> "Performance Events:" (or just send me the whole thing :-) ).
>
I can see the hang in 3 of 4 qemu / kvm configurations running with
"-smp 2".
qemu == Performance Events: p6 PMU driver.
qemu-system-x86_64 == Performance Events: AMD PMU driver.
kvm on RHEL 5 == Performance Events: p6 PMU driver.
kgdb tests pass with 64 bit kvm on unbutu 10.10 test system and it prints:
Performance Events: unsupported p6 CPU model 2 no PMU driver, software
events only.
I suspect it works because of the "unsupported". The real p4 system I
have also duplicates the hang just like what you are seeing.
I don't believe this is the right way to fix the problem, but it does
work around the problem using the following patch (found below). I
made that patch simply so I could execute some more testing and fix
some of the other regressions I did not know about. The patch is
merely a crude way to say this NMI here really doesn't belong to the
perf call back. The problem with this is that it would be exteremely
racy if you are starting and stopping the debugger. There would be
the possibility for lost events etc...
Jason.
--
---
arch/x86/kernel/cpu/perf_event.c | 3 ++-
include/linux/kgdb.h | 3 +++
2 files changed, 5 insertions(+), 1 deletion(-)
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -25,6 +25,7 @@
#include <linux/highmem.h>
#include <linux/cpu.h>
#include <linux/bitops.h>
+#include <linux/kgdb.h>
#include <asm/apic.h>
#include <asm/stacktrace.h>
@@ -1221,7 +1222,7 @@ perf_event_nmi_handler(struct notifier_b
unsigned int this_nmi;
int handled;
- if (!atomic_read(&active_events))
+ if (!atomic_read(&active_events) || in_debug_core())
return NOTIFY_DONE;
switch (cmd) {
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -307,12 +307,15 @@ extern int kgdb_nmicallback(int cpu, voi
extern int kgdb_single_step;
extern atomic_t kgdb_active;
+#define in_debug_core() \
+ (atomic_read(&kgdb_active) != -1)
#define in_dbg_master() \
(raw_smp_processor_id() == atomic_read(&kgdb_active))
extern bool dbg_is_early;
extern void __init dbg_late_init(void);
#else /* ! CONFIG_KGDB */
#define in_dbg_master() (0)
+#define in_debug_core() (0)
#define dbg_late_init()
#endif /* ! CONFIG_KGDB */
#endif /* _KGDB_H_ */
next prev parent reply other threads:[~2010-11-18 15:19 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-11-12 14:43 [V2 PATCH 0/6] x86, NMI: give NMI handler a face-lift Don Zickus
2010-11-12 14:43 ` [PATCH 1/6] x86, NMI: Add NMI symbol constants and rename memory parity to PCI SERR Don Zickus
2010-11-12 14:43 ` [PATCH 2/6] x86, NMI: Add touch_nmi_watchdog to io_check_error delay Don Zickus
2010-11-12 14:43 ` [PATCH 3/6] x86, NMI: Rewrite NMI handler Don Zickus
2010-11-12 14:43 ` [PATCH 4/6] x86, NMI: Remove DIE_NMI_IPI and add priorties to handlers Don Zickus
2010-11-12 14:43 ` [PATCH 5/6] x86, NMI: Allow NMI reason io port (0x61) to be processed on any CPU Don Zickus
2010-11-12 14:43 ` [PATCH 6/6] x86, NMI: Remove do_nmi_callback logic Don Zickus
2010-11-12 15:05 ` [V2 PATCH 0/6] x86, NMI: give NMI handler a face-lift Jason Wessel
2010-11-12 15:42 ` Don Zickus
2010-11-12 15:55 ` Jason Wessel
2010-11-12 16:11 ` Don Zickus
2010-11-12 16:34 ` Jason Wessel
2010-11-12 17:27 ` Don Zickus
2010-11-16 18:43 ` Don Zickus
2010-11-16 20:04 ` Jason Wessel
2010-11-18 8:05 ` Ingo Molnar
2010-11-18 12:47 ` Jason Wessel
2010-11-18 13:17 ` Peter Zijlstra
2010-11-18 14:32 ` Don Zickus
2010-11-18 15:18 ` Jason Wessel [this message]
2010-11-18 15:38 ` Peter Zijlstra
2010-11-18 19:32 ` Don Zickus
2010-11-18 19:51 ` Jason Wessel
2010-11-18 20:04 ` Peter Zijlstra
2010-11-18 20:08 ` Don Zickus
2010-11-18 20:11 ` Cyrill Gorcunov
2010-11-18 20:52 ` Don Zickus
2010-11-18 21:01 ` Cyrill Gorcunov
2010-11-18 21:16 ` Don Zickus
2010-11-18 21:26 ` Cyrill Gorcunov
2010-11-18 20:28 ` Cyrill Gorcunov
2010-11-18 20:39 ` Cyrill Gorcunov
2010-11-18 21:02 ` Don Zickus
2010-11-18 21:19 ` Cyrill Gorcunov
2010-11-18 20:30 ` Peter Zijlstra
2010-11-19 16:59 ` Don Zickus
2010-11-19 18:25 ` Peter Zijlstra
2010-11-19 22:59 ` Don Zickus
2010-11-19 23:09 ` Peter Zijlstra
2010-11-19 23:30 ` Jason Wessel
2010-11-22 14:22 ` Don Zickus
2010-11-22 14:22 ` Don Zickus
2010-11-22 14:29 ` Peter Zijlstra
2010-11-18 20:04 ` Cyrill Gorcunov
2010-11-18 21:56 ` Cyrill Gorcunov
2010-11-18 21:58 ` Cyrill Gorcunov
2010-11-18 22:15 ` Cyrill Gorcunov
2010-11-18 22:24 ` Jason Wessel
2010-11-18 22:27 ` Cyrill Gorcunov
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=4CE543BB.2010903@windriver.com \
--to=jason.wessel@windriver.com \
--cc=andi@firstfloor.org \
--cc=dzickus@redhat.com \
--cc=fweisbec@gmail.com \
--cc=gorcunov@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.com \
--cc=ying.huang@intel.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