Re: [PATCH -v2 7/7] x86, NMI, Remove do_nmi_callback logic

From: huang ying
Date: Mon Sep 27 2010 - 08:56:51 EST


On Mon, Sep 27, 2010 at 6:44 PM, Robert Richter <robert.richter@xxxxxxx> wrote:
> On 26.09.10 20:57:06, Huang Ying wrote:
>> do_nmi_callback related logic is removed, because it is useless, just
>> adds code complexity.
>>
>> unknown_nmi_panic sysctl is reserved to keep kernel ABI unchanged.
>
> "unknown_nmi_panic" and "panic_on_unrecovered_nmi" are different. See
> below and also Documentation/sysctl/kernel.txt.
>
>>
>> Signed-off-by: Huang Ying <ying.huang@xxxxxxxxx>
>> ---
>> Âarch/x86/include/asm/nmi.h  Â|  10 +++++++++-
>> Âarch/x86/kernel/apic/hw_nmi.c | Â Â1 -
>> Âarch/x86/kernel/apic/nmi.c  Â|  29 +----------------------------
>> Âarch/x86/kernel/traps.c    |  16 ++++++++++------
>> Â4 files changed, 20 insertions(+), 36 deletions(-)
>>
>> --- a/arch/x86/include/asm/nmi.h
>> +++ b/arch/x86/include/asm/nmi.h
>> @@ -30,9 +30,17 @@ extern void setup_apic_nmi_watchdog(void
>> Âextern void stop_apic_nmi_watchdog(void *);
>> Âextern void disable_timer_nmi_watchdog(void);
>> Âextern void enable_timer_nmi_watchdog(void);
>> -extern int nmi_watchdog_tick(struct pt_regs *regs, unsigned reason);
>> Âextern void cpu_nmi_set_wd_enabled(void);
>>
>> +#if defined(CONFIG_X86_LOCAL_APIC) && !defined(CONFIG_LOCKUP_DETECTOR)
>> +extern int nmi_watchdog_tick(struct pt_regs *regs);
>> +#else
>> +static inline int nmi_watchdog_tick(struct pt_regs *regs)
>> +{
>> + Â Â return 0;
>> +}
>> +#endif
>> +
>> Âextern atomic_t nmi_active;
>> Âextern unsigned int nmi_watchdog;
>> Â#define NMI_NONE Â Â 0
>> --- a/arch/x86/kernel/apic/hw_nmi.c
>> +++ b/arch/x86/kernel/apic/hw_nmi.c
>> @@ -100,7 +100,6 @@ void acpi_nmi_disable(void) { return; }
>> Â#endif
>> Âatomic_t nmi_active = ATOMIC_INIT(0); Â Â Â Â Â /* oprofile uses this */
>> ÂEXPORT_SYMBOL(nmi_active);
>> -int unknown_nmi_panic;
>> Âvoid cpu_nmi_set_wd_enabled(void) { return; }
>> Âvoid stop_apic_nmi_watchdog(void *unused) { return; }
>> Âvoid setup_apic_nmi_watchdog(void *unused) { return; }
>> --- a/arch/x86/kernel/apic/nmi.c
>> +++ b/arch/x86/kernel/apic/nmi.c
>> @@ -37,7 +37,6 @@
>>
>> Â#include <asm/mach_traps.h>
>>
>> -int unknown_nmi_panic;
>> Âint nmi_watchdog_enabled;
>>
>> Â/* For reliability, we're prepared to waste bits here. */
>> @@ -389,7 +388,7 @@ void touch_nmi_watchdog(void)
>> ÂEXPORT_SYMBOL(touch_nmi_watchdog);
>>
>> Ânotrace __kprobes int
>> -nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
>> +nmi_watchdog_tick(struct pt_regs *regs)
>> Â{
>> Â Â Â /*
>> Â Â Â Â* Since current_thread_info()-> is always on the stack, and we
>> @@ -483,23 +482,6 @@ static void disable_ioapic_nmi_watchdog(
>> Â Â Â on_each_cpu(stop_apic_nmi_watchdog, NULL, 1);
>> Â}
>>
>> -static int __init setup_unknown_nmi_panic(char *str)
>> -{
>> - Â Â unknown_nmi_panic = 1;
>> - Â Â return 1;
>> -}
>> -__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
>> -
>> -static int unknown_nmi_panic_callback(struct pt_regs *regs, int cpu)
>> -{
>> - Â Â unsigned char reason = get_nmi_reason();
>> - Â Â char buf[64];
>> -
>> - Â Â sprintf(buf, "NMI received for unknown reason %02x\n", reason);
>> - Â Â die_nmi(buf, regs, 1); /* Always panic here */
>> - Â Â return 0;
>
> You are dropping this code that is different to panic().

What is the difference? Is it relevant?

Best Regards,
Huang Ying
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/