Skip to contentSkip to conversation

x86: fix boot time APIC mode detection

PATCH In review Jan Beulich 3 participants 3 messages May 23, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86: fix boot time APIC mode detection

current_cpu_data becomes valid only relatively late in the boot process, so looking there for a particular feature early in the game would generally give the appearance of the feature being unavailable.

Getting this wrong means that at kexec time the system would get returned to xAPIC mode, causing disconnect_bsp_APIC() to try to access the APIC page, which on systems with x2APIC pre-enabled will never get set up.

xen/arch/x86/apic.c +1 -1
@@ -1474,7 +1474,7 @@ enum apic_mode current_local_apic_mode(v
 
     /* Reading EXTD bit from the MSR is only valid if CPUID
      * says so, else reserved */
-    if ( cpu_has(&current_cpu_data, X86_FEATURE_X2APIC)
+    if ( boot_cpu_has(X86_FEATURE_X2APIC)
          && (msr_contents & MSR_IA32_APICBASE_EXTD) )
         return APIC_MODE_X2APIC;
 

x86: fix boot time APIC mode detection

current_cpu_data becomes valid only relatively late in the boot process, so looking there for a particular feature early in the game would generally give the appearance of the feature being unavailable.

Getting this wrong means that at kexec time the system would get returned to xAPIC mode, causing disconnect_bsp_APIC() to try to access the APIC page, which on systems with x2APIC pre-enabled will never get set up.

xen/arch/x86/apic.c +1 -1
@@ -1474,7 +1474,7 @@ enum apic_mode current_local_apic_mode(v
 
     /* Reading EXTD bit from the MSR is only valid if CPUID
      * says so, else reserved */
-    if ( cpu_has(&current_cpu_data, X86_FEATURE_X2APIC)
+    if ( boot_cpu_has(X86_FEATURE_X2APIC)
          && (msr_contents & MSR_IA32_APICBASE_EXTD) )
         return APIC_MODE_X2APIC;
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jan Beulich

current_cpu_data becomes valid only relatively late in the boot process, so looking there for a particular feature early in the game would generally give the appearance of the feature being unavailable.

Getting this wrong means that at kexec time the system would get returned to xAPIC mode, causing disconnect_bsp_APIC() to try to access the APIC page, which on systems with x2APIC pre-enabled will never get set up.

Quoted 14 lines
xen/arch/x86/apic.c +1 -1
@@ -1474,7 +1474,7 @@ enum apic_mode current_local_apic_mode(v
 
     /* Reading EXTD bit from the MSR is only valid if CPUID
      * says so, else reserved */
-    if ( cpu_has(&current_cpu_data, X86_FEATURE_X2APIC)
+    if ( boot_cpu_has(X86_FEATURE_X2APIC)
          && (msr_contents & MSR_IA32_APICBASE_EXTD) )
         return APIC_MODE_X2APIC;
 
Reviewed-by on v1 1/1
#2 lore raw
In reply to Jan Beulich
Quoted 10 lines · Jan Beulich

current_cpu_data becomes valid only relatively late in the boot process, so looking there for a particular feature early in the game would generally give the appearance of the feature being unavailable.

Getting this wrong means that at kexec time the system would get returned to xAPIC mode, causing disconnect_bsp_APIC() to try to access the APIC page, which on systems with x2APIC pre-enabled will never get set up.

Quoted 15 lines
xen/arch/x86/apic.c +1 -1
@@ -1474,7 +1474,7 @@ enum apic_mode current_local_apic_mode(v
 
     /* Reading EXTD bit from the MSR is only valid if CPUID
      * says so, else reserved */
-    if ( cpu_has(&current_cpu_data, X86_FEATURE_X2APIC)
+    if ( boot_cpu_has(X86_FEATURE_X2APIC)
          && (msr_contents & MSR_IA32_APICBASE_EXTD) )
         return APIC_MODE_X2APIC;