From f7ccadac2d3fe373d14a5917c86c499770ebbffc Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Wed, 14 Jan 2015 18:31:33 +0100 Subject: [PATCH] x86/apic: Clear stale x2apic mode If x2apic got disabled on the kernel command line, then the following issue can happen: enable_IR_x2apic() .... x2apic_mode = 1; enable_x2apic(); if (x2apic_disabled) { __disable_x2apic(); return; } That leaves X2APIC disabled in hardware, but x2apic_mode stays 1. So all other code which checks x2apic_mode gets the wrong information. Set x2apic_mode to 0 after disabling it in hardware. This is just a hotfix. The proper solution is to rework this code so it has seperate functions for the initial setup on the boot processor and the secondary cpus, but that's beyond the scope of this fix. Signed-off-by: Thomas Gleixner Cc: Jiang Liu Cc: Tony Luck Cc: iommu@lists.linux-foundation.org Cc: H. Peter Anvin Cc: Joerg Roedel Cc: Benjamin Herrenschmidt Cc: Yinghai Lu Cc: Borislav Petkov Cc: David Rientjes Cc: HATAYAMA Daisuke Cc: Jan Beulich Cc: Richard Weinberger Cc: Oren Twaig --- arch/x86/kernel/apic/apic.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c index 141f1031013d..8a81a681836e 100644 --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1559,6 +1559,7 @@ void enable_x2apic(void) rdmsrl(MSR_IA32_APICBASE, msr); if (x2apic_disabled) { __disable_x2apic(msr); + x2apic_mode = 0; return; } -- 2.30.2