From: Mikael Pettersson <mikpe@csd.uu.se>
To: alan@lxorguk.ukuu.org.uk, torvalds@transmeta.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] fix 2.4 SMP kernel hang on UP P4
Date: Sat, 27 Oct 2001 18:23:33 +0200 (MET DST) [thread overview]
Message-ID: <200110271623.SAA04333@harpo.it.uu.se> (raw)
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;
next reply other threads:[~2001-10-27 16:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-27 16:23 Mikael Pettersson [this message]
2001-10-27 17:18 ` arjan
2001-10-27 19:24 Mikael Pettersson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200110271623.SAA04333@harpo.it.uu.se \
--to=mikpe@csd.uu.se \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@transmeta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®