From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:52513 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752660AbbIKWlc (ORCPT ); Fri, 11 Sep 2015 18:41:32 -0400 Subject: Patch "x86/apic: Fix fallout from x2apic cleanup" has been added to the 4.1-stable tree To: tglx@linutronix.de, bp@alien8.de, gregkh@linuxfoundation.org, javiermon@gmail.com, jiang.liu@linux.intel.com, joro@8bytes.org, labbott@redhat.com, tony.luck@intel.com Cc: , From: Date: Fri, 11 Sep 2015 15:41:30 -0700 Message-ID: <14420112904588@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled x86/apic: Fix fallout from x2apic cleanup to the 4.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-apic-fix-fallout-from-x2apic-cleanup.patch and it can be found in the queue-4.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From a57e456a7b28431b55e407e5ab78ebd5b378d19e Mon Sep 17 00:00:00 2001 From: Thomas Gleixner Date: Sat, 22 Aug 2015 16:41:17 +0200 Subject: x86/apic: Fix fallout from x2apic cleanup From: Thomas Gleixner commit a57e456a7b28431b55e407e5ab78ebd5b378d19e upstream. In the recent x2apic cleanup I got two things really wrong: 1) The safety check in __disable_x2apic which allows the function to be called unconditionally is backwards. The check is there to prevent access to the apic MSR in case that the machine has no apic. Though right now it returns if the machine has an apic and therefor the disabling of x2apic is never invoked. 2) x2apic_disable() sets x2apic_mode to 0 after registering the local apic. That's wrong, because register_lapic_address() checks x2apic mode and therefor takes the wrong code path. This results in boot failures on machines with x2apic preenabled by BIOS and can also lead to an fatal MSR access on machines without apic. The solutions are simple: 1) Correct the sanity check for apic availability 2) Clear x2apic_mode _before_ calling register_lapic_address() Fixes: 659006bf3ae3 'x86/x2apic: Split enable and setup function' Reported-and-tested-by: Javier Monteagudo Signed-off-by: Thomas Gleixner Link: https://bugzilla.redhat.com/show_bug.cgi?id=1224764 Cc: Laura Abbott Cc: Jiang Liu Cc: Joerg Roedel Cc: Tony Luck Cc: Borislav Petkov Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/apic/apic.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) --- a/arch/x86/kernel/apic/apic.c +++ b/arch/x86/kernel/apic/apic.c @@ -1424,7 +1424,7 @@ static inline void __x2apic_disable(void { u64 msr; - if (cpu_has_apic) + if (!cpu_has_apic) return; rdmsrl(MSR_IA32_APICBASE, msr); @@ -1483,10 +1483,13 @@ void x2apic_setup(void) static __init void x2apic_disable(void) { - u32 x2apic_id; + u32 x2apic_id, state = x2apic_state; - if (x2apic_state != X2APIC_ON) - goto out; + x2apic_mode = 0; + x2apic_state = X2APIC_DISABLED; + + if (state != X2APIC_ON) + return; x2apic_id = read_apic_id(); if (x2apic_id >= 255) @@ -1494,9 +1497,6 @@ static __init void x2apic_disable(void) __x2apic_disable(); register_lapic_address(mp_lapic_addr); -out: - x2apic_state = X2APIC_DISABLED; - x2apic_mode = 0; } static __init void x2apic_enable(void) Patches currently in stable-queue which might be from tglx@linutronix.de are queue-4.1/perf-fix-perf_event_ioc_period-migration-race.patch queue-4.1/irqchip-crossbar-restore-the-mask-on-suspend-behaviour.patch queue-4.1/genirq-don-t-return-enosys-in-irq_chip_retrigger_hierarchy.patch queue-4.1/perf-fix-fasync-handling-on-inherited-events.patch queue-4.1/x86-idle-restore-trace_cpu_idle-to-mwait_idle-calls.patch queue-4.1/perf-fix-double-free-of-the-aux-buffer.patch queue-4.1/irqchip-crossbar-restore-set_wake-functionality.patch queue-4.1/perf-fix-running-time-accounting.patch queue-4.1/x86-apic-fix-fallout-from-x2apic-cleanup.patch queue-4.1/irqchip-crossbar-restore-the-irq_set_type-mechanism.patch queue-4.1/genirq-introduce-irq_chip_set_type_parent-helper.patch queue-4.1/arm-omap-wakeupgen-restore-the-irq_set_type-mechanism.patch