lkml.org 
[lkml]   [2011]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH -tip 2/2 resend] x86, traps: Drop nmi_reason_lock until it is really needed
At moment we have only BSP apic configured to listen
for external NMIs. So there is no reason for additional
spinlock since only BSP will receive them.

Though we still have UV chips which do enable external NMIs
on all cpus, but since an approach to allow retrieving
NMI reason on BSP only was working pretty fine before --
I assume it still remains valid.

Also it's worth to mention that an initial idea of all this
NMI code-path changes was to make BSP hot-unpluggable but
until all other parts of kernel is prepared for it (which
might consume quite a time to implement) I believe we should
not lock/unlock for nothing.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
arch/x86/kernel/traps.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

Index: linux-2.6.git/arch/x86/kernel/traps.c
=====================================================================
--- linux-2.6.git.orig/arch/x86/kernel/traps.c
+++ linux-2.6.git/arch/x86/kernel/traps.c
@@ -84,11 +84,6 @@ EXPORT_SYMBOL_GPL(used_vectors);
static int ignore_nmis;

int unknown_nmi_panic;
-/*
- * Prevent NMI reason port (0x61) being accessed simultaneously, can
- * only be used in NMI handler.
- */
-static DEFINE_RAW_SPINLOCK(nmi_reason_lock);

static inline void conditional_sti(struct pt_regs *regs)
{
@@ -406,9 +401,12 @@ static notrace __kprobes void default_do
if (notify_die(DIE_NMI, "nmi", regs, 0, 2, SIGINT) == NOTIFY_STOP)
return;

- /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */
- raw_spin_lock(&nmi_reason_lock);
- reason = get_nmi_reason();
+ /*
+ * Only BSP is configured to listen and handle external NMIs.
+ * Note this implicitly orders a call to the get_nmi_reason.
+ */
+ if (!smp_processor_id())
+ reason = get_nmi_reason();

if (reason & NMI_REASON_MASK) {
if (reason & NMI_REASON_SERR)
@@ -422,10 +420,8 @@ static notrace __kprobes void default_do
*/
reassert_nmi();
#endif
- raw_spin_unlock(&nmi_reason_lock);
return;
}
- raw_spin_unlock(&nmi_reason_lock);

unknown_nmi_error(reason, regs);
}
--
Cyrill


\
 
 \ /
  Last update: 2011-03-02 16:35    [W:0.078 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site