Commit 5a84cc04 authored by Zwane Mwaikambo's avatar Zwane Mwaikambo Committed by Linus Torvalds

[PATCH] do_nmi needs irq_enter/irq_exit lovin...

Use new "nmi_enter/exit()" which acts the same as the regular irq
entries (increases the preempt count appropriately), but doesn't try to
start processing softirqs on nmi exit (it just decreases the count).
parent 61599636
...@@ -526,12 +526,17 @@ static nmi_callback_t nmi_callback = dummy_nmi_callback; ...@@ -526,12 +526,17 @@ static nmi_callback_t nmi_callback = dummy_nmi_callback;
asmlinkage void do_nmi(struct pt_regs * regs, long error_code) asmlinkage void do_nmi(struct pt_regs * regs, long error_code)
{ {
int cpu = smp_processor_id(); int cpu;
nmi_enter();
cpu = smp_processor_id();
++nmi_count(cpu); ++nmi_count(cpu);
if (!nmi_callback(regs, cpu)) if (!nmi_callback(regs, cpu))
default_do_nmi(regs); default_do_nmi(regs);
nmi_exit();
} }
void set_nmi_callback(nmi_callback_t callback) void set_nmi_callback(nmi_callback_t callback)
......
...@@ -76,6 +76,8 @@ typedef struct { ...@@ -76,6 +76,8 @@ typedef struct {
#define hardirq_endlock() do { } while (0) #define hardirq_endlock() do { } while (0)
#define irq_enter() (preempt_count() += HARDIRQ_OFFSET) #define irq_enter() (preempt_count() += HARDIRQ_OFFSET)
#define nmi_enter() (irq_enter())
#define nmi_exit() (preempt_count() -= HARDIRQ_OFFSET)
#if CONFIG_PREEMPT #if CONFIG_PREEMPT
# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) # define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment