Skip to contentSkip to conversation

x86_64 nmi_watchdog: Make check_nmi_watchdog static

PATCH In review Eric W. Biederman 2 participants 5 messages Oct 4, 2005

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86_64 nmi_watchdog: Make check_nmi_watchdog static

By using a late_initcall as i386 does we don't need to call check_nmi_watchdog manually after SMP startup, and we don't need different code paths for SMP and non SMP.

This paves the way for moving apic initialization into init_IRQ, where it belongs.

---

 arch/x86_64/kernel/apic.c    |    1 -
 arch/x86_64/kernel/nmi.c     |    7 ++++++-
 arch/x86_64/kernel/smpboot.c |    2 --
 include/asm-x86_64/nmi.h     |    2 --
 4 files changed, 6 insertions(+), 6 deletions(-)

b80634473f58ddea568a41e9a779676bed64dc9c

arch/x86_64/kernel/apic.c +0 -1
@@ -1061,7 +1061,6 @@ int __init APIC_init_uniprocessor (void)
 		nr_ioapics = 0;
 #endif
 	setup_boot_APIC_clock();
-	check_nmi_watchdog();
 	return 0;
 }
 
arch/x86_64/kernel/nmi.c +6 -1
@@ -139,12 +139,15 @@ static __init void nmi_cpu_busy(void *da
 }
 #endif
 
-int __init check_nmi_watchdog (void)
+static int __init check_nmi_watchdog (void)
 {
 	volatile int endflag = 0;
 	int *counts;
 	int cpu;
 
+	if (nmi_watchdog == NMI_NONE)
+		return 0;
+
 	counts = kmalloc(NR_CPUS * sizeof(int), GFP_KERNEL);
 	if (!counts)
 		return -1;
@@ -186,6 +189,8 @@ int __init check_nmi_watchdog (void)
 	kfree(counts);
 	return 0;
 }
+/* This needs to happen later in boot so counters are working */
+late_initcall(check_nmi_watchdog);
 
 int __init setup_nmi_watchdog(char *str)
 {
arch/x86_64/kernel/smpboot.c +0 -2
@@ -1077,8 +1077,6 @@ void __init smp_cpus_done(unsigned int m
 #endif
 
 	time_init_gtod();
-
-	check_nmi_watchdog();
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
include/asm-x86_64/nmi.h +0 -2
@@ -54,6 +54,4 @@ extern void die_nmi(char *str, struct pt
 extern int panic_on_timeout;
 extern int unknown_nmi_panic;
 
-extern int check_nmi_watchdog(void);
- 
 #endif /* ASM_NMI_H */
#1 lore raw
Quoted 6 lines · Eric W. Biederman

By using a late_initcall as i386 does we don't need to call check_nmi_watchdog manually after SMP startup, and we don't need different code paths for SMP and non SMP.

This paves the way for moving apic initialization into init_IRQ, where it belongs.

I don't like it. I want to see a clear message in the log when the NMI watchdog doesn't work and with your patch that comes too late.

-Andi (who has rejected similar patches before)

#2 lore raw
Quoted 10 lines · Andi Kleen
Quoted 6 lines · Eric W. Biederman

By using a late_initcall as i386 does we don't need to call check_nmi_watchdog manually after SMP startup, and we don't need different code paths for SMP and non SMP.

This paves the way for moving apic initialization into init_IRQ, where it belongs.

I don't like it. I want to see a clear message in the log when the NMI watchdog doesn't work and with your patch that comes too late.

Why is it to late?

Quoted 1 line

-Andi (who has rejected similar patches before)

Would it be more appropriate to make this a per cpu check? I am just trying to make the code path clean so we don't have special SMP/non-SMP logic. Anything that achieves that is fine with me.

Eric

#3 lore raw
Quoted 6 lines · Eric W. Biederman
Quoted 5 lines · Andi Kleen
Quoted 4 lines · Eric W. Biederman

By using a late_initcall as i386 does we don't need to call check_nmi_watchdog manually after SMP startup, and we don't need different code paths for SMP and non SMP.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

This paves the way for moving apic initialization into init_IRQ, where it belongs.

I don't like it. I want to see a clear message in the log when the NMI watchdog doesn't work and with your patch that comes too late.

Why is it to late?

It's after too much of the boot. e.g. consider analyzing log with a boot hang. It's important to know if the NMI watchdog runs or not. For that it is best when the test of it happens as early as possible.

Quoted 4 lines
Quoted 2 lines

-Andi (who has rejected similar patches before)

Would it be more appropriate to make this a per cpu check?

That would be fine as long as it's as early as possible. But I suspect you'll always need special cases for the BP because it needs the timer running first.

-Andi

#4 lore raw
Quoted 10 lines · Andi Kleen
Quoted 9 lines · Eric W. Biederman
Quoted 8 lines · Andi Kleen
Quoted 6 lines · Eric W. Biederman

By using a late_initcall as i386 does we don't need to call check_nmi_watchdog manually after SMP startup, and we don't need different code paths for SMP and non SMP.

This paves the way for moving apic initialization into init_IRQ, where it belongs.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

I don't like it. I want to see a clear message in the log when the NMI watchdog doesn't work and with your patch that comes too late.

Why is it to late?

It's after too much of the boot. e.g. consider analyzing log with a boot hang. It's important to know if the NMI watchdog runs or not. For that it is best when the test of it happens as early as possible.

That make sense.

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

-Andi (who has rejected similar patches before)

Would it be more appropriate to make this a per cpu check?

That would be fine as long as it's as early as possible. But I suspect you'll always need special cases for the BP because it needs the timer running first.

Well a special call site certainly but I can probably get away with a single function called from the appropriate CPU. I might even be able to remove nmi_cpu_busy :)

It will take me a bit to get my head back into that part of the code. late_initcall was a nice solution from a correctness and simplicity point of view. But obviously it had other issues :)

There is the whole late_timer_init() which is probably where the test needs to happen for the boot processor.

Eric