[PATCH] Don't access the APIC in safe_smp_processor_id when it is not mapped yet
authorAndi Kleen <ak@suse.de>
Tue, 26 Sep 2006 08:52:34 +0000 (10:52 +0200)
committerAndi Kleen <andi@basil.nowhere.org>
Tue, 26 Sep 2006 08:52:34 +0000 (10:52 +0200)
Lockdep can call the dwarf2 unwinder early, and the dwarf2 code
uses safe_smp_processor_id which tries to access the local APIC page.
But that doesn't work before the APIC code has set up its fixmap.

Check for this case and always return boot cpu then.

Cc: jbeulich@novell.com
Cc: mingo@elte.hu
Signed-off-by: Andi Kleen <ak@suse.de>
arch/x86_64/kernel/apic.c
arch/x86_64/kernel/smp.c
include/asm-x86_64/apic.h

index b95d1e378b96a19ec307ba8264edb3f3100e6258..6472e321cad7d0d6d682cf8e846a7f48ea761086 100644 (file)
@@ -38,6 +38,7 @@
 #include <asm/timex.h>
 #include <asm/apic.h>
 
+int apic_mapped;
 int apic_verbosity;
 int apic_runs_main_timer;
 int apic_calibrate_pmtmr __initdata;
@@ -600,6 +601,7 @@ void __init init_apic_mappings(void)
                apic_phys = mp_lapic_addr;
 
        set_fixmap_nocache(FIX_APIC_BASE, apic_phys);
+       apic_mapped = 1;
        apic_printk(APIC_VERBOSE,"mapped APIC to %16lx (%16lx)\n", APIC_BASE, apic_phys);
 
        /*
index 06af6ca601295e8253b95b999435710fdc8672e2..2df988bbf3124bfe6356b5a4c145483d589fcf15 100644 (file)
@@ -526,7 +526,7 @@ int safe_smp_processor_id(void)
 {
        unsigned apicid, i;
 
-       if (disable_apic)
+       if (disable_apic || !apic_mapped)
                return 0;
 
        apicid = hard_smp_processor_id();
index 29ee735278f23bf9aff1663fbfc814e13e886ed4..9e66d32330c9d5a5371fb3b6e59f709cf7ac67eb 100644 (file)
@@ -18,6 +18,7 @@
 extern int apic_verbosity;
 extern int apic_runs_main_timer;
 extern int ioapic_force;
+extern int apic_mapped;
 
 /*
  * Define the default level of output to be very little