From: Ingo Molnar <mingo@elte.hu>
To: Lee Revell <rlrevell@joe-job.com>
Cc: Andrea Arcangeli <andrea@suse.de>,
Manfred Spraul <manfred@colorfullife.com>,
Zwane Mwaikambo <zwane@arm.linux.org.uk>,
George Anzinger <george@mvista.com>,
dipankar@in.ibm.com, ganzinger@mvista.com,
lkml <linux-kernel@vger.kernel.org>,
Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>,
Andi Kleen <ak@suse.de>
Subject: [patch, 2.6.10-rc3] safe_hlt() & NMIs
Date: Tue, 14 Dec 2004 23:23:07 +0100 [thread overview]
Message-ID: <20041214222307.GB22043@elte.hu> (raw)
In-Reply-To: <1103060437.14699.27.camel@krustophenia.net>
* Lee Revell <rlrevell@joe-job.com> wrote:
> On Sun, 2004-12-12 at 13:15 +0100, Andrea Arcangeli wrote:
> > Overall this is a very minor issue (unless HZ is 0), it would only
> > introduce a 1/HZ latency to the irq that get posted while the nmi
> > handler is running, and the nmi handlers never runs in production.
>
> Ingo, couldn't this account for some of the inexplicable outliers some
> people were seeing in latency tests?
indeed, there could be a connection, and it's certainly a fun race. The
proper fix is Manfred's suggestion: check whether the EIP is a kernel
text address, and if yes, whether it's a HLT instruction - and if yes
then increase EIP by 1. I've included the fix in the -33-02 -RT patch.
Andrew, Linus: upstream fix is below - i think it's post-2.6.10 stuff.
Tested it on SMP and UP x86, using both the IO-APIC and the local-APIC
based NMI watchdog.
i think x64 needs a similar fix as well.
Ingo
--- linux/arch/i386/kernel/traps.c.orig
+++ linux/arch/i386/kernel/traps.c
@@ -670,6 +670,17 @@ fastcall void do_nmi(struct pt_regs * re
cpu = smp_processor_id();
+ /*
+ * Fix up obscure CPU behavior: if we interrupt safe_hlt() via
+ * the NMI then we might miss a reschedule if an interrupt is
+ * posted to the CPU and executes before the HLT instruction.
+ *
+ * We check whether the EIP is kernelspace, and if yes, whether
+ * the instruction is HLT:
+ */
+ if (__kernel_text_address(regs->eip) && *(char *)regs->eip == 0xf4)
+ regs->eip++;
+
#ifdef CONFIG_HOTPLUG_CPU
if (!cpu_online(cpu)) {
nmi_exit();
next prev parent reply other threads:[~2004-12-14 22:28 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-12-09 23:59 RCU question George Anzinger
2004-12-10 4:31 ` Dipankar Sarma
2004-12-10 19:42 ` George Anzinger
2004-12-10 20:40 ` Dipankar Sarma
2004-12-10 20:45 ` Lee Revell
2004-12-10 21:02 ` George Anzinger
2004-12-10 22:58 ` Zwane Mwaikambo
2004-12-11 2:22 ` George Anzinger
2004-12-11 2:45 ` Zwane Mwaikambo
2004-12-11 3:29 ` George Anzinger
2004-12-11 14:52 ` Zwane Mwaikambo
2004-12-11 16:32 ` Manfred Spraul
2004-12-11 16:52 ` George Anzinger
2004-12-12 2:53 ` Zwane Mwaikambo
2004-12-12 8:59 ` Manfred Spraul
2004-12-12 9:37 ` Andrea Arcangeli
2004-12-12 10:22 ` Manfred Spraul
2004-12-12 12:15 ` Andrea Arcangeli
2004-12-14 21:40 ` Lee Revell
2004-12-14 22:23 ` Ingo Molnar [this message]
2004-12-14 22:47 ` [patch, 2.6.10-rc3] safe_hlt() & NMIs Ingo Molnar
2004-12-14 23:09 ` Linus Torvalds
2004-12-15 8:52 ` Ingo Molnar
2004-12-15 15:44 ` Linus Torvalds
2004-12-15 16:35 ` Ingo Molnar
2004-12-16 0:37 ` Alan Cox
2004-12-16 1:58 ` Linus Torvalds
2004-12-16 14:51 ` Ingo Molnar
2004-12-16 15:08 ` Maciej W. Rozycki
2004-12-16 15:11 ` Ingo Molnar
2004-12-16 15:42 ` Maciej W. Rozycki
2004-12-16 15:54 ` Linus Torvalds
2004-12-16 2:10 ` Zwane Mwaikambo
2004-12-16 13:26 ` Alan Cox
2004-12-14 23:41 ` Andrea Arcangeli
2004-12-14 23:00 ` Linus Torvalds
2004-12-15 5:04 ` Andi Kleen
2004-12-15 6:27 ` Avi Kivity
2004-12-15 8:51 ` Ingo Molnar
2004-12-12 16:51 ` RCU question George Anzinger
2004-12-12 22:40 ` Manfred Spraul
2004-12-13 5:22 ` George Anzinger
2004-12-12 16:26 ` Zwane Mwaikambo
2004-12-17 23:35 [patch, 2.6.10-rc3] safe_hlt() & NMIs Chuck Ebbert
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=20041214222307.GB22043@elte.hu \
--to=mingo@elte.hu \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=andrea@suse.de \
--cc=dipankar@in.ibm.com \
--cc=ganzinger@mvista.com \
--cc=george@mvista.com \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--cc=rlrevell@joe-job.com \
--cc=torvalds@osdl.org \
--cc=zwane@arm.linux.org.uk \
/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
all inboxes | Powered by JetHome®