From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xen.org>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
Keir Fraser <keir@xen.org>,
David Vrabel <david.vrabel@citrix.com>,
Jan Beulich <JBeulich@suse.com>, Tim Deegan <tim@xen.org>
Subject: [Patch v2 2/2] x86/crash: Disable the watchdog NMIs on the crashing cpu
Date: Wed, 20 Nov 2013 15:08:29 +0000 [thread overview]
Message-ID: <1384960109-25960-1-git-send-email-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <1384547567-17059-3-git-send-email-andrew.cooper3@citrix.com>
From: David Vrabel <david.vrabel@citrix.com>
nmi_shootdown_cpus() is called during a crash to park all the other
CPUs. This changes the NMI trap handlers which means there's no point
in having the watchdog still running.
This also disables the watchdog before executing any crash kexec image
and prevents the image from receiving unexpected NMIs.
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
PVOps Linux as a kexec image shoots itself in the foot otherwise.
On a Core2 system, Linux declares a firmware bug and tries to invert some bits
in the performance counter register. It ends up setting the number of retired
instructions to generate another NMI to fewer instructions than the NMI
interrupt path itself, and ceases to make any useful progress.
The call to disable_lapic_nmi_watchdog() must be this late into the kexec path
to be sure that this cpu is the one which will execute the kexec image.
Otherwise there are race conditions where the NMIs might be disabled on the
wrong cpu, resulting in the kexec image still receiving NMIs.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Tim Deegan <tim@xen.org>
---
Changes in v2:
* Return the original commit message which I originally failed to find in our
source control, and further clarify the positioning of the call.
---
xen/arch/x86/crash.c | 1 +
xen/arch/x86/nmi.c | 2 +-
xen/include/asm-x86/apic.h | 1 +
3 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/xen/arch/x86/crash.c b/xen/arch/x86/crash.c
index 4ef379b..01fd906 100644
--- a/xen/arch/x86/crash.c
+++ b/xen/arch/x86/crash.c
@@ -118,6 +118,7 @@ static void nmi_shootdown_cpus(void)
unsigned long msecs;
int i, cpu = smp_processor_id();
+ disable_lapic_nmi_watchdog();
local_irq_disable();
crashing_cpu = cpu;
diff --git a/xen/arch/x86/nmi.c b/xen/arch/x86/nmi.c
index 2c16d93..c67a9c3 100644
--- a/xen/arch/x86/nmi.c
+++ b/xen/arch/x86/nmi.c
@@ -165,7 +165,7 @@ static void nmi_timer_fn(void *unused)
set_timer(&this_cpu(nmi_timer), NOW() + MILLISECS(1000));
}
-static void disable_lapic_nmi_watchdog(void)
+void disable_lapic_nmi_watchdog(void)
{
if (nmi_active <= 0)
return;
diff --git a/xen/include/asm-x86/apic.h b/xen/include/asm-x86/apic.h
index dd528fb..43b39ce 100644
--- a/xen/include/asm-x86/apic.h
+++ b/xen/include/asm-x86/apic.h
@@ -200,6 +200,7 @@ extern void smp_local_timer_interrupt (struct cpu_user_regs *regs);
extern void setup_boot_APIC_clock (void);
extern void setup_secondary_APIC_clock (void);
extern void setup_apic_nmi_watchdog (void);
+extern void disable_lapic_nmi_watchdog(void);
extern int reserve_lapic_nmi(void);
extern void release_lapic_nmi(void);
extern void self_nmi(void);
--
1.7.10.4
prev parent reply other threads:[~2013-11-20 15:08 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-15 20:32 [PATCH 0/2] Kexec crash path fixes Andrew Cooper
2013-11-15 20:32 ` [PATCH 1/2] common/kexec: Prevent deadlock on reentry to the crash path Andrew Cooper
2013-11-22 14:55 ` Andrew Cooper
2013-11-25 13:28 ` Jan Beulich
2013-11-25 13:30 ` Andrew Cooper
2013-11-25 13:39 ` Jan Beulich
2013-11-25 15:38 ` Andrew Cooper
2013-11-27 10:27 ` David Vrabel
2013-11-15 20:32 ` [PATCH 2/2] x86/crash: Disable the watchdog NMIs on the crashing cpu Andrew Cooper
2013-11-15 21:01 ` David Vrabel
2013-11-15 21:09 ` Andrew Cooper
2013-11-18 9:26 ` Jan Beulich
2013-11-18 10:33 ` Andrew Cooper
2013-11-18 10:35 ` Andrew Cooper
2013-11-18 11:04 ` Jan Beulich
2013-11-18 11:09 ` Andrew Cooper
2013-11-19 10:53 ` Ian Campbell
2013-11-20 15:08 ` Andrew Cooper [this message]
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=1384960109-25960-1-git-send-email-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=david.vrabel@citrix.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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).