linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: George Spelvin <linux@horizon.com>
Cc: airlied@gmail.com, dzickus@redhat.com,
	linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl,
	ming.m.lin@intel.com, eranian@google.com, sruffell@digium.com
Subject: Re: Uhhuh. NMI received for unknown reason 2d on CPU 0.
Date: Wed, 13 Apr 2011 09:06:11 +0400	[thread overview]
Message-ID: <BANLkTi=k0GMrWV5covpnGBfB30UO14z-HA@mail.gmail.com> (raw)
In-Reply-To: <BANLkTi=AOvVELYKA=BSTsOLbzfZyDg8UaQ@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 256 bytes --]

On Wed, Apr 13, 2011 at 8:34 AM, Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> There is a patch fromDon we are testing now, i will resend it in a couple of
> hours.
>

George, mind to give these patches a shot please? (Sorry for sending
it as attachment).

[-- Attachment #2: don-apic-nmi-unmask-fix.patch --]
[-- Type: application/octet-stream, Size: 1687 bytes --]

From: Don Zickus <dzickus@redhat.com>
Date: Tue, 12 Apr 2011 12:30:31 -0400
Subject: [PATCH] perf, x86: fix unknown NMIs on a Pentium4 box

When using perf on a Pentium4 box, lots of unknown NMIs would be generated.
This is the result of a P4 quirk that is subtle.  The P4 generates an NMI
when the counter overflow and unlike other arches where the NMI is a one time
event, the P4 continues to assert its NMI until clear by the OS.

As a side effect to this quirk, the NMI on the apic is masked off to prevent
a stream of NMIs until the overflow flag is cleared.  During the perf
re-design, this subtle-ness was overlooked and the apic was unmasked _before_
the overflow flag was cleared.  As a result, this generated an extra NMI on
the P4 mchines.

The fix is trivial, wait until the NMI is properly handled before un-masking
the apic.

Sadly, in the old nmi watchdog there was a note that explained this exact
behaviour.

Signed-off-by: Don Zickus <dzickus@redhat.com>
Tested-by: Shaun Ruffell <sruffell@digium.com>
Tested-by: Cyrill Gorcunov <gorcunov@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 arch/x86/kernel/cpu/perf_event.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index eed3673a..e108ef8 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -1370,9 +1370,9 @@ perf_event_nmi_handler(struct notifier_block *self,
 		return NOTIFY_DONE;
 	}
 
-	apic_write(APIC_LVTPC, APIC_DM_NMI);
 
 	handled = x86_pmu.handle_irq(args->regs);
+	apic_write(APIC_LVTPC, APIC_DM_NMI);
 	if (!handled)
 		return NOTIFY_DONE;
 
-- 
1.7.4.2


  parent reply	other threads:[~2011-04-13  5:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13  3:19 Uhhuh. NMI received for unknown reason 2d on CPU 0 George Spelvin
     [not found] ` <BANLkTi=AOvVELYKA=BSTsOLbzfZyDg8UaQ@mail.gmail.com>
2011-04-13  5:06   ` Cyrill Gorcunov [this message]
2011-04-14 15:16     ` George Spelvin
2011-04-14 15:22       ` 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='BANLkTi=k0GMrWV5covpnGBfB30UO14z-HA@mail.gmail.com' \
    --to=gorcunov@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=airlied@gmail.com \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@horizon.com \
    --cc=ming.m.lin@intel.com \
    --cc=sruffell@digium.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).