x86_32: move do_nmi() to nmi_32.c
PATCH 1/1 x86_32: move do_nmi() to nmi_32.c
From: Hiroshi Shimamoto <[email protected]>
on x86_64 do_nmi() is in nmi_64.c.
--- arch/x86/kernel/nmi_32.c | 30 ++++++++++++++++++++++++++++++ arch/x86/kernel/traps_32.c | 32 +------------------------------- include/asm-x86/nmi.h | 3 ++- 3 files changed, 33 insertions(+), 32 deletions(-)
arch/x86/kernel/nmi_32.c +30 -0
@@ -398,6 +398,36 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)return rc; } +static unsigned ignore_nmis; + +notrace __kprobes void do_nmi(struct pt_regs *regs, long error_code) +{ +int cpu; + +nmi_enter (); + + cpu =smp_processor_id (); + + ++nmi_count (cpu); + +if (!ignore_nmis) +default_do_nmi (regs); + +nmi_exit (); +} + +void stop_nmi (void ) +{ +acpi_nmi_disable (); + ignore_nmis++; +} + +void restart_nmi (void ) +{ + ignore_nmis--; +acpi_nmi_enable (); +} +#ifdef CONFIG_SYSCTL static int unknown_nmi_panic_callback (struct pt_regs *regs,int cpu)
arch/x86/kernel/traps_32.c +1 -31
@@ -787,7 +787,7 @@ void notrace __kprobes die_nmi(struct pt_regs *regs, const char *msg)do_exit (SIGSEGV ); } -static notrace __kprobes void default_do_nmi(struct pt_regs *regs) +notrace __kprobes void default_do_nmi(struct pt_regs *regs) {unsigned char reason =0 ;
@@ -827,36 +827,6 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)reassert_nmi (); } -static int ignore_nmis; - -notrace __kprobes void do_nmi(struct pt_regs *regs, long error_code) -{ -int cpu; - -nmi_enter (); - - cpu =smp_processor_id (); - - ++nmi_count (cpu); - -if (!ignore_nmis) -default_do_nmi (regs); - -nmi_exit (); -} - -void stop_nmi (void ) -{ -acpi_nmi_disable (); - ignore_nmis++; -} - -void restart_nmi (void ) -{ - ignore_nmis--; -acpi_nmi_enable (); -} -#ifdef CONFIG_KPROBES void __kprobes do_int3 (struct pt_regs *regs,long error_code) {
include/asm-x86/nmi.h +2 -1
@@ -37,13 +37,14 @@ static inline void unset_nmi_pm_callback(struct pm_dev *dev)#endif /* CONFIG_PM */ #ifdef CONFIG_X86_64 -extern void default_do_nmi (struct pt_regs *);extern void die_nmi (char *str,struct pt_regs *regs,int do_panic);extern void nmi_watchdog_default (void );#else #define nmi_watchdog_default () do {} while (0)#endif +extern void default_do_nmi (struct pt_regs *); +extern int check_nmi_watchdog (void );extern int nmi_watchdog_enabled;extern int unknown_nmi_panic;
Signature · 1 line
1.5.4.1
Quoted 6 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
on
x86_64do_nmi()is innmi_64.c.Signed-off-by Hiroshi Shimamoto <[email protected]>---
Applied. Are you targeting to merge the 32/64 nmi code eventually ?
Thanks,
tglx
Quoted 10 lines · Thomas Gleixner
Quoted 6 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
on
x86_64do_nmi()is innmi_64.c.Signed-off-by Hiroshi Shimamoto <[email protected]>---
Applied. Are you targeting to merge the 32/64 nmi code eventually ?
Yeah, there are duplicated codes in nmi_*.c.
thanks,
Hiroshi Shimamoto
Quoted 3 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
on
x86_64do_nmi()is innmi_64.c.
this patch caused build failure on x86.git+sched-devel.git:
arch/x86/kernel/built-in.o: In function `nmi_stack_correct':
arch/x86/kernel/entry_32.S:(.kprobes.text+0x117): undefined reference to do_nmi' arch/x86/kernel/built-in.o: In function nmi_espfix_stack':
arch/x86/kernel/entry_32.S:(.kprobes.text+0x1c3): undefined reference to do_nmi' arch/x86/kernel/built-in.o: In function alternative_instructions':
: undefined reference to `stop_nmi'arch/x86/kernel/built-in.o: In function `alternative_instructions':
: undefined reference to `restart_nmi'
with this config:
http://redhat.com/~mingo/misc/config-Sun_May__4_11_25_21_CEST_2008.bad
Ingo
Quoted 17 lines · Ingo Molnar
Quoted 3 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
on
x86_64do_nmi()is innmi_64.c.this patch caused build failure on x86.git+sched-devel.git:
arch/x86/kernel/built-in.o: In function `nmi_stack_correct':
arch/x86/kernel/entry_32.S:(.kprobes.text+0x117): undefined reference todo_nmi' arch/x86/kernel/built-in.o: In functionnmi_espfix_stack':
arch/x86/kernel/entry_32.S:(.kprobes.text+0x1c3): undefined reference todo_nmi' arch/x86/kernel/built-in.o: In functionalternative_instructions':
: undefined reference to `stop_nmi'arch/x86/kernel/built-in.o: In function `alternative_instructions':
: undefined reference to `restart_nmi'
Quoted 3 lines
with this config:
http://redhat.com/~mingo/misc/config-Sun_May__4_11_25_21_CEST_2008.bad
Oops, I've missed something.
Will work. If you don't want it soon, please remove it from the queue.
thanks,
Hiroshi Shimamoto
Quoted 17 lines · Hiroshi Shimamoto
Quoted 16 lines · Ingo Molnar
Quoted 3 lines · Hiroshi Shimamoto
From: Hiroshi Shimamoto <[email protected]>
on
x86_64do_nmi()is innmi_64.c.this patch caused build failure on x86.git+sched-devel.git:
arch/x86/kernel/built-in.o: In function `nmi_stack_correct':
arch/x86/kernel/entry_32.S:(.kprobes.text+0x117): undefined reference todo_nmi' arch/x86/kernel/built-in.o: In functionnmi_espfix_stack':
arch/x86/kernel/entry_32.S:(.kprobes.text+0x1c3): undefined reference todo_nmi' arch/x86/kernel/built-in.o: In functionalternative_instructions':
: undefined reference to `stop_nmi'arch/x86/kernel/built-in.o: In function `alternative_instructions':
: undefined reference to `restart_nmi'
Quoted 8 lines
Quoted 3 lines
with this config:
http://redhat.com/~mingo/misc/config-Sun_May__4_11_25_21_CEST_2008.bad
Oops, I've missed something.
Will work. If you don't want it soon, please remove it from the queue.
Ah, CONFIG_X86_LOCAL_APIC is needed for nmi_32.o. I should have noticed before submitting this patch.
thanks,
Hiroshi Shimamoto