lkml.org 
[lkml]   [2008]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] x86: traps_xx: modify default_do_nmi
 - local caching of smp_processor_id()

Signed-off-by: Alexander van Heukelum <heukelum@fastmail.fm>
---
arch/x86/kernel/traps_32.c | 12 ++++++++----
arch/x86/kernel/traps_64.c | 3 ++-
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/arch/x86/kernel/traps_32.c b/arch/x86/kernel/traps_32.c
index 68e800f..14fe3cd 100644
--- a/arch/x86/kernel/traps_32.c
+++ b/arch/x86/kernel/traps_32.c
@@ -790,12 +790,16 @@ void notrace __kprobes die_nmi(char *str, struct pt_regs *regs, int do_panic)
do_exit(SIGSEGV);
}

-static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
+static notrace __kprobes void
+default_do_nmi(struct pt_regs *regs)
{
unsigned char reason = 0;
+ int cpu;
+
+ cpu = smp_processor_id();

- /* Only the BSP gets external NMIs from the system: */
- if (!smp_processor_id())
+ /* Only the BSP gets external NMIs from the system. */
+ if (!cpu)
reason = get_nmi_reason();

if (!(reason & 0xc0)) {
@@ -809,7 +813,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
*/
if (nmi_watchdog_tick(regs, reason))
return;
- if (!do_nmi_callback(regs, smp_processor_id()))
+ if (!do_nmi_callback(regs, cpu))
unknown_nmi_error(reason, regs);
#else
unknown_nmi_error(reason, regs);
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c
index 677b4e5..2f8d87d 100644
--- a/arch/x86/kernel/traps_64.c
+++ b/arch/x86/kernel/traps_64.c
@@ -832,7 +832,8 @@ unknown_nmi_error(unsigned char reason, struct pt_regs * regs)

/* Runs on IST stack. This code must keep interrupts off all the time.
Nested NMIs are prevented by the CPU. */
-asmlinkage notrace __kprobes void default_do_nmi(struct pt_regs *regs)
+asmlinkage notrace __kprobes void
+default_do_nmi(struct pt_regs *regs)
{
unsigned char reason = 0;
int cpu;
--
1.5.4.3


\
 
 \ /
  Last update: 2008-07-02 01:37    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site