public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static
@ 2005-10-04 15:11 Eric W. Biederman
  2005-10-04 15:21 ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2005-10-04 15:11 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, fastboot, Andi Kleen


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.

Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>


---

 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
diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
--- a/arch/x86_64/kernel/apic.c
+++ b/arch/x86_64/kernel/apic.c
@@ -1061,7 +1061,6 @@ int __init APIC_init_uniprocessor (void)
 		nr_ioapics = 0;
 #endif
 	setup_boot_APIC_clock();
-	check_nmi_watchdog();
 	return 0;
 }
 
diff --git a/arch/x86_64/kernel/nmi.c b/arch/x86_64/kernel/nmi.c
--- a/arch/x86_64/kernel/nmi.c
+++ b/arch/x86_64/kernel/nmi.c
@@ -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)
 {
diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c
--- a/arch/x86_64/kernel/smpboot.c
+++ b/arch/x86_64/kernel/smpboot.c
@@ -1077,8 +1077,6 @@ void __init smp_cpus_done(unsigned int m
 #endif
 
 	time_init_gtod();
-
-	check_nmi_watchdog();
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
diff --git a/include/asm-x86_64/nmi.h b/include/asm-x86_64/nmi.h
--- a/include/asm-x86_64/nmi.h
+++ b/include/asm-x86_64/nmi.h
@@ -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 */

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static
  2005-10-04 15:11 [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static Eric W. Biederman
@ 2005-10-04 15:21 ` Andi Kleen
  2005-10-04 15:26   ` Eric W. Biederman
  0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2005-10-04 15:21 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Andrew Morton, linux-kernel, fastboot

On Tuesday 04 October 2005 17:11, Eric W. Biederman wrote:
> 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)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static
  2005-10-04 15:21 ` Andi Kleen
@ 2005-10-04 15:26   ` Eric W. Biederman
  2005-10-04 15:32     ` Andi Kleen
  0 siblings, 1 reply; 5+ messages in thread
From: Eric W. Biederman @ 2005-10-04 15:26 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-kernel, fastboot

Andi Kleen <ak@suse.de> writes:

> On Tuesday 04 October 2005 17:11, Eric W. Biederman wrote:
>> 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?

> -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


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static
  2005-10-04 15:26   ` Eric W. Biederman
@ 2005-10-04 15:32     ` Andi Kleen
  2005-10-04 16:01       ` Eric W. Biederman
  0 siblings, 1 reply; 5+ messages in thread
From: Andi Kleen @ 2005-10-04 15:32 UTC (permalink / raw)
  To: Eric W. Biederman; +Cc: Andrew Morton, linux-kernel, fastboot

On Tuesday 04 October 2005 17:26, Eric W. Biederman wrote:
> Andi Kleen <ak@suse.de> writes:
> > On Tuesday 04 October 2005 17:11, Eric W. Biederman wrote:
> >> 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?

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.

>
> > -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static
  2005-10-04 15:32     ` Andi Kleen
@ 2005-10-04 16:01       ` Eric W. Biederman
  0 siblings, 0 replies; 5+ messages in thread
From: Eric W. Biederman @ 2005-10-04 16:01 UTC (permalink / raw)
  To: Andi Kleen; +Cc: Andrew Morton, linux-kernel, fastboot

Andi Kleen <ak@suse.de> writes:

> On Tuesday 04 October 2005 17:26, Eric W. Biederman wrote:
>> Andi Kleen <ak@suse.de> writes:
>> > On Tuesday 04 October 2005 17:11, Eric W. Biederman wrote:
>> >> 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?
>
> 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.

>> > -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-10-04 16:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-04 15:11 [PATCH 1/2] x86_64 nmi_watchdog: Make check_nmi_watchdog static Eric W. Biederman
2005-10-04 15:21 ` Andi Kleen
2005-10-04 15:26   ` Eric W. Biederman
2005-10-04 15:32     ` Andi Kleen
2005-10-04 16:01       ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox