mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fix 2.4 SMP kernel hang on UP P4
@ 2001-10-27 16:23 Mikael Pettersson
  2001-10-27 17:18 ` arjan
  0 siblings, 1 reply; 3+ messages in thread
From: Mikael Pettersson @ 2001-10-27 16:23 UTC (permalink / raw)
  To: alan, torvalds; +Cc: linux-kernel

Linus & Alan,

A 2.4 kernel built with SMP or UP_APIC support may hang during boot
if run on a UP P4 machine. The patch below fixes this, please apply.

The events that lead to the hang are:
1. The BIOS boots the OS with the local APIC enabled. cpu_has_apic is true.
2. init_apic_mappings() calls detect_init_APIC().
3. detect_init_APIC() doesn't know about the P4, so it returns failure.
4. init_apic_mappings() maps the local APIC to a dummy page.
5. Much later, APIC_init_uniprocessor() sees that cpu_has_apic is true,
   so it calls setup_APIC_clocks().
6. setup_APIC_clocks() calls calibrate_APIC_clock().
7. Since the local APIC was mapped to a dummy page, calibrate_APIC_clock()
   doesn't actually touch the HW. It detects and returns a 0 MHz bus clock.
8. setup_APIC_clocks() calls setup_APIC_timer() with the 0 MHz bus clock.
9. setup_APIC_timer() spins in a loop, waiting to APIC_TMCCT to decrement.
   But APIC_TMCCT is in the dummy page, so it doesn't change and the
   loop never terminates. At this point, you'll see something like:

Using local APIC timer interrupts.
calibrating APIC timer ...
..... CPU clock speed is 1707.5365 MHz.
..... host bus clock speed is 0.0000 MHz.
cpu: 0, clocks: 0, slice: 0
// hangs

The fix simply ensures that detect_init_APIC() doesn't return failure
when running on a P4 with an already enabled local APIC.

/Mikael

--- linux-2.4.13/arch/i386/kernel/apic.c.~1~	Thu Oct 11 13:34:39 2001
+++ linux-2.4.13/arch/i386/kernel/apic.c	Sat Oct 27 17:47:49 2001
@@ -588,6 +588,7 @@
 		goto no_apic;
 	case X86_VENDOR_INTEL:
 		if (boot_cpu_data.x86 == 6 ||
+		    (boot_cpu_data.x86 == 15 && cpu_has_apic) ||
 		    (boot_cpu_data.x86 == 5 && cpu_has_apic))
 			break;
 		goto no_apic;

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

* Re: [PATCH] fix 2.4 SMP kernel hang on UP P4
  2001-10-27 16:23 [PATCH] fix 2.4 SMP kernel hang on UP P4 Mikael Pettersson
@ 2001-10-27 17:18 ` arjan
  0 siblings, 0 replies; 3+ messages in thread
From: arjan @ 2001-10-27 17:18 UTC (permalink / raw)
  To: Mikael Pettersson; +Cc: linux-kernel

In article <200110271623.SAA04333@harpo.it.uu.se> you wrote:
> Linus & Alan,

> A 2.4 kernel built with SMP or UP_APIC support may hang during boot
> if run on a UP P4 machine. The patch below fixes this, please apply.

can you also try a very recent -ac kernel (smp) and pass "acpismp=force" on
the lilo commandline ?

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

* Re: [PATCH] fix 2.4 SMP kernel hang on UP P4
@ 2001-10-27 19:24 Mikael Pettersson
  0 siblings, 0 replies; 3+ messages in thread
From: Mikael Pettersson @ 2001-10-27 19:24 UTC (permalink / raw)
  To: arjan; +Cc: linux-kernel

On Sat, 27 Oct 2001 18:18:58 +0100, arjan@fenrus.demon.nl wrote:
>> A 2.4 kernel built with SMP or UP_APIC support may hang during boot
>> if run on a UP P4 machine. The patch below fixes this, please apply.
>
>can you also try a very recent -ac kernel (smp) and pass "acpismp=force" on
>the lilo commandline ?

Tried 2.4.13-ac3 with CONFIG_SMP=y and acpismp=force.
It's a UP box, no SMP config is found, so get_smp_config()
and config_acpi_tables() are never called. Hangs like before.

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

end of thread, other threads:[~2001-10-27 19:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-27 16:23 [PATCH] fix 2.4 SMP kernel hang on UP P4 Mikael Pettersson
2001-10-27 17:18 ` arjan
2001-10-27 19:24 Mikael Pettersson

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

all inboxes | Powered by JetHome®