mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org,
	Greg KH <greg@kroah.com>
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Yong Wang <yong.y.wang@intel.com>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Arjan van de Ven <arjan@infradead.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: [72/90] [PATCH .31-stable] x86: Under BIOS control, restore APs APIC_LVTTHMR to the BSP value
Date: Wed, 16 Dec 2009 17:15:23 -0800	[thread overview]
Message-ID: <20091217011607.388210554@mini.kroah.org> (raw)
In-Reply-To: <20091217011835.GA20434@kroah.com>

2.6.31-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Yong Wang <yong.y.wang@linux.intel.com>

Upstream commit a2202aa29289db64ca7988b12343158b67b27f10.

On platforms where bios handles the thermal monitor interrupt,
APIC_LVTTHMR on each logical CPU is programmed to generate a SMI and OS
can't touch it.

Unfortunately AP bringup sequence using INIT-SIPI-SIPI clear all
the LVT entries except the mask bit. Essentially this results in
all LVT entries including the thermal monitoring interrupt set to masked
(clearing the bios programmed value for APIC_LVTTHMR).

And this leads to kernel take over the thermal monitoring interrupt
on AP's but not on BSP (leaving the bios programmed value only on BSP).

As a result of this, we have seen system hangs when the thermal
monitoring interrupt is generated.

Fix this by reading the initial value of thermal LVT entry on BSP
and if bios has taken over the control, then program the same value
on all AP's and leave the thermal monitoring interrupt control
on all the logical cpu's to the bios.

Signed-off-by: Yong Wang <yong.y.wang@intel.com>
Reviewed-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Borislav Petkov <borislav.petkov@amd.com>
Cc: Arjan van de Ven <arjan@infradead.org>
LKML-Reference: <20091110013824.GA24940@ywang-moblin2.bj.intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 arch/x86/include/asm/mce.h               |    6 ++++++
 arch/x86/kernel/cpu/mcheck/therm_throt.c |   29 ++++++++++++++++++++++++++++-
 arch/x86/kernel/setup.c                  |    3 +++
 3 files changed, 37 insertions(+), 1 deletion(-)

--- a/arch/x86/include/asm/mce.h
+++ b/arch/x86/include/asm/mce.h
@@ -214,5 +214,11 @@ void mce_log_therm_throt_event(__u64 sta
 static inline void mce_log_therm_throt_event(__u64 status) {}
 #endif
 
+#ifdef CONFIG_X86_THERMAL_VECTOR
+extern void mcheck_intel_therm_init(void);
+#else
+static inline void mcheck_intel_therm_init(void) { }
+#endif
+
 #endif /* __KERNEL__ */
 #endif /* _ASM_X86_MCE_H */
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -49,6 +49,8 @@ static DEFINE_PER_CPU(struct thermal_sta
 
 static atomic_t therm_throt_en	= ATOMIC_INIT(0);
 
+static u32 lvtthmr_init __read_mostly;
+
 #ifdef CONFIG_SYSFS
 #define define_therm_throt_sysdev_one_ro(_name)				\
 	static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL)
@@ -254,6 +256,18 @@ asmlinkage void smp_thermal_interrupt(st
 	ack_APIC_irq();
 }
 
+void __init mcheck_intel_therm_init(void)
+{
+	/*
+	 * This function is only called on boot CPU. Save the init thermal
+	 * LVT value on BSP and use that value to restore APs' thermal LVT
+	 * entry BIOS programmed later
+	 */
+	if (cpu_has(&boot_cpu_data, X86_FEATURE_ACPI) &&
+		cpu_has(&boot_cpu_data, X86_FEATURE_ACC))
+		lvtthmr_init = apic_read(APIC_LVTTHMR);
+}
+
 void intel_init_thermal(struct cpuinfo_x86 *c)
 {
 	unsigned int cpu = smp_processor_id();
@@ -270,7 +284,20 @@ void intel_init_thermal(struct cpuinfo_x
 	 * since it might be delivered via SMI already:
 	 */
 	rdmsr(MSR_IA32_MISC_ENABLE, l, h);
-	h = apic_read(APIC_LVTTHMR);
+
+	/*
+	 * The initial value of thermal LVT entries on all APs always reads
+	 * 0x10000 because APs are woken up by BSP issuing INIT-SIPI-SIPI
+	 * sequence to them and LVT registers are reset to 0s except for
+	 * the mask bits which are set to 1s when APs receive INIT IPI.
+	 * Always restore the value that BIOS has programmed on AP based on
+	 * BSP's info we saved since BIOS is always setting the same value
+	 * for all threads/cores
+	 */
+	apic_write(APIC_LVTTHMR, lvtthmr_init);
+
+	h = lvtthmr_init;
+
 	if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) {
 		printk(KERN_DEBUG
 		       "CPU%d: Thermal monitoring handled by SMI\n", cpu);
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -107,6 +107,7 @@
 #ifdef CONFIG_X86_64
 #include <asm/numa_64.h>
 #endif
+#include <asm/mce.h>
 
 #ifndef ARCH_SETUP
 #define ARCH_SETUP
@@ -1030,6 +1031,8 @@ void __init setup_arch(char **cmdline_p)
 	conswitchp = &dummy_con;
 #endif
 #endif
+
+	mcheck_intel_therm_init();
 }
 
 #ifdef CONFIG_X86_32



  parent reply	other threads:[~2009-12-17  1:28 UTC|newest]

Thread overview: 94+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-17  1:18 [00/90] 2.6.31.9-stable review Greg KH
2009-12-17  1:14 ` [01/90] USB: option: add pid for ZTE Greg KH
2009-12-17  1:14 ` [02/90] USB: usb-storage: fix bug in fill_inquiry Greg KH
2009-12-17  1:14 ` [03/90] firewire: ohci: handle receive packets with a data length of zero Greg KH
2009-12-17  1:14 ` [04/90] ALSA: hda - Terradici HDA controllers does not support 64-bit mode Greg KH
2009-12-17  1:14 ` [05/90] ALSA: hrtimer - Fix lock-up Greg KH
2009-12-17  1:14 ` [06/90] ath5k: allow setting txpower to 0 Greg KH
2009-12-17  1:14 ` [07/90] ath5k: enable EEPROM checksum check Greg KH
2009-12-17  1:14 ` [08/90] bsdacct: fix uid/gid misreporting Greg KH
2009-12-17  1:14 ` [09/90] debugfs: fix create mutex racy fops and private data Greg KH
2009-12-17  1:14 ` [10/90] devpts_get_tty() should validate inode Greg KH
2009-12-17  1:14 ` [11/90] futex: Take mmap_sem for get_user_pages in fault_in_user_writeable Greg KH
2009-12-17  1:14 ` [12/90] hfs: fix a potential buffer overflow Greg KH
2009-12-17  1:14 ` [13/90] hrtimer: Fix /proc/timer_list regression Greg KH
2009-12-17  1:14 ` [14/90] jbd2: dont wipe the journal on a failed journal checksum Greg KH
2009-12-17  1:14 ` [15/90] KVM: s390: Make psw available on all exits, not just a subset Greg KH
2009-12-17  1:14 ` [16/90] md/bitmap: protect against bitmap removal while being updated Greg KH
2009-12-17  1:14 ` [17/90] pata_hpt{37x|3x2n}: fix timing register masks (take 2) Greg KH
2009-12-17  1:14 ` [18/90] [ARM] pxa/em-x270: fix usb hub power up/reset sequence Greg KH
2009-12-17  1:14 ` [19/90] ssb: Fix range check in sprom write Greg KH
2009-12-17  1:14 ` [20/90] SUNRPC: IS_ERR/PTR_ERR confusion Greg KH
2009-12-17  1:14 ` [21/90] USB: Close usb_find_interface race v3 Greg KH
2009-12-17  1:14 ` [22/90] USB: musb_gadget_ep0: fix unhandled endpoint 0 IRQs, again Greg KH
2009-12-17  1:14 ` [23/90] USB: option.c: add support for D-Link DWM-162-U5 Greg KH
2009-12-17  1:14 ` [24/90] USB: usb-storage: add BAD_SENSE flag Greg KH
2009-12-17  1:14 ` [25/90] USB: usbtmc: repeat usb_bulk_msg until whole message is transfered Greg KH
2009-12-17  1:14 ` [26/90] V4L/DVB: Fix test in copy_reg_bits() Greg KH
2009-12-17  1:14 ` [27/90] x86: Add new Intel CPU cache size descriptors Greg KH
2009-12-17  1:14 ` [28/90] x86/amd-iommu: attach devices to pre-allocated domains early Greg KH
2009-12-17  1:14 ` [29/90] x86/amd-iommu: un__init iommu_setup_msi Greg KH
2009-12-17  1:14 ` [30/90] x86, apic: Enable lapic nmi watchdog on AMD Family 11h Greg KH
2009-12-17  1:14 ` [31/90] x86: ASUS P4S800 reboot=bios quirk Greg KH
2009-12-17  1:14 ` [32/90] x86, Calgary IOMMU quirk: Find nearest matching Calgary while walking up the PCI tree Greg KH
2009-12-17  1:14 ` [33/90] x86: Fix iommu=nodac parameter handling Greg KH
2009-12-17  1:14 ` [34/90] x86: Fix typo in Intel CPU cache size descriptor Greg KH
2009-12-17  1:14 ` [35/90] x86: GART: pci-gart_64.c: Use correct length in strncmp Greg KH
2009-12-17  1:14 ` [36/90] drm/radeon/kms: Add quirk for HIS X1300 board Greg KH
2009-12-17  1:14 ` [37/90] drm/radeon/kms: fix legacy crtc2 dpms Greg KH
2009-12-17  1:14 ` [38/90] mac80211: Fix bug in computing crc over dynamic IEs in beacon Greg KH
2009-12-17  1:14 ` [39/90] mm: hugetlb: fix hugepage memory leak in mincore() Greg KH
2009-12-17  1:14 ` [40/90] mm: hugetlb: fix hugepage memory leak in walk_page_range() Greg KH
2009-12-17  1:14 ` [41/90] powerpc: Fix usage of 64-bit instruction in 32-bit altivec code Greg KH
2009-12-17  1:14 ` [42/90] Serial: Do not read IIR in serial8250_start_tx when UART_BUG_TXEN Greg KH
2009-12-17  1:14 ` [43/90] ide: Serialize CMD643 and CMD646 to fix a hardware bug with SSD Greg KH
2009-12-17  1:14 ` [44/90] ide: fix ioctl to pass requested transfer mode to ide_find_dma_mode instead of UDMA6 Greg KH
2009-12-17  1:14 ` [45/90] Revert "ide: try to use PIO Mode 0 during probe if possible" Greg KH
2009-12-17  1:14 ` [46/90] slc90e66: fix UDMA handling Greg KH
2009-12-17  1:14 ` [47/90] Au1x00: fix crash when trying register_netdev() Greg KH
2009-12-17  1:14 ` [48/90] b44 WOL setup: one-bit-off stack corruption kernel panic fix Greg KH
2009-12-17  1:15 ` [49/90] b44: Fix wedge when using netconsole Greg KH
2009-12-17  1:15 ` [50/90] e100: Use pci pool to work around GFP_ATOMIC order 5 memory allocation failure Greg KH
2009-12-17 15:03   ` Roger Oksanen
2009-12-17 15:09     ` Greg KH
2009-12-17 15:16       ` Roger Oksanen
2009-12-17  1:15 ` [51/90] gro: Fix illegal merging of trailer trash Greg KH
2009-12-17  1:15 ` [52/90] ip_fragment: also adjust skb->truesize for packets not owned by a socket Greg KH
2009-12-17  1:15 ` [53/90] Revert "isdn: isdn_ppp: Use SKB list facilities instead of home-grown implementation." Greg KH
2009-12-17  1:15 ` [54/90] net: Fix the rollback test in dev_change_name() Greg KH
2009-12-17  1:15 ` [55/90] NET: smc91x: Fix irq flags Greg KH
2009-12-17  1:15 ` [56/90] smsc9420: prevent BUG() if ethtool is called with interface down Greg KH
2009-12-17  1:15 ` [57/90] vlan: Fix register_vlan_dev() error path Greg KH
2009-12-17  1:15 ` [58/90] sparc64: Fix definition of VMEMMAP_SIZE Greg KH
2009-12-17  1:15 ` [59/90] sunsab: Do not set sunsab_reg.cons right before registering minors Greg KH
2009-12-17  1:15 ` [60/90] sunsu: Fix detection of SU ports which are RSC console or control Greg KH
2009-12-17  1:15 ` [61/90] serial: suncore: Add ignore_line argument to sunserial_console_match() Greg KH
2009-12-17  1:15 ` [62/90] serial: suncore: Fix RSC/LOM handling in sunserial_console_termios() Greg KH
2009-12-17  1:15 ` [63/90] sunsu: Pass true ignore_line to console match when RSC or LOM console Greg KH
2009-12-17  1:15 ` [64/90] sunsu: Use sunserial_console_termios() in sunsu_console_setup() Greg KH
2009-12-17  1:15 ` [65/90] sparc64: Dont specify IRQF_SHARED for LDC interrupts Greg KH
2009-12-17  1:15 ` [66/90] sparc64: Fix overly strict range type matching for PCI devices Greg KH
2009-12-17  1:15 ` [67/90] sparc64: Fix stack debugging IRQ stack regression Greg KH
2009-12-17  1:15 ` [68/90] sparc: Set UTS_MACHINE correctly Greg KH
2009-12-17  1:15 ` [69/90] x86/mce: Set up timer unconditionally Greg KH
2009-12-17  1:15 ` [70/90] b43legacy: avoid PPC fault during resume Greg KH
2009-12-17  1:15 ` [71/90] p54usb: Remove DMA buffer from stack Greg KH
2009-12-17  1:15 ` Greg KH [this message]
2009-12-17  1:15 ` [73/90] ACPI: Use the ARB_DISABLE for the CPU which model id is less than 0x0f Greg KH
2009-12-17  1:15 ` [74/90] asus-laptop: change light sens default values Greg KH
2009-12-17  1:15 ` [75/90] backlight: lcd - Fix wrong sizeof Greg KH
2009-12-17  1:15 ` [76/90] drm/i915: Avoid NULL dereference with component_only tv_modes Greg KH
2009-12-17  1:15 ` [77/90] drm/i915: Fix CRT hotplug detect by checking really no channels attached Greg KH
2009-12-17  1:15 ` [78/90] drm/i915: Fix LVDS stability issue on Ironlake Greg KH
2009-12-17  1:15 ` [79/90] drm/i915: save/restore BLC histogram control reg across suspend/resume Greg KH
2009-12-17  1:15 ` [80/90] drm/i915: PineView only has LVDS and CRT ports Greg KH
2009-12-17  1:15 ` [81/90] ext3: Fix data / filesystem corruption when write fails to copy data Greg KH
2009-12-17  1:15 ` [82/90] ipvs: zero usvc and udest Greg KH
2009-12-17  1:15 ` [83/90] ipw2100: fix rebooting hang with driver loaded Greg KH
2009-12-17  1:15 ` [84/90] jffs2: Fix long-standing bug with symlink garbage collection Greg KH
2009-12-17  1:15 ` [85/90] matroxfb: fix problems with display stability Greg KH
2009-12-17  1:15 ` [86/90] net: Fix userspace RTM_NEWLINK notifications Greg KH
2009-12-17  1:15 ` [87/90] sysctl_max_map_count should be non-negative Greg KH
2009-12-17  1:15 ` [88/90] thinkpad-acpi: fix default brightness_mode for R50e/R51 Greg KH
2009-12-17  1:15 ` [89/90] thinkpad-acpi: preserve rfkill state across suspend/resume Greg KH
2009-12-17  1:15 ` [90/90] V4L/DVB (13116): gspca - ov519: Webcam 041e:4067 added Greg KH

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=20091217011607.388210554@mini.kroah.org \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=arjan@infradead.org \
    --cc=borislav.petkov@amd.com \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=yong.y.wang@intel.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®