From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756923AbZKFGNk (ORCPT ); Fri, 6 Nov 2009 01:13:40 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756105AbZKFGNj (ORCPT ); Fri, 6 Nov 2009 01:13:39 -0500 Received: from mga12.intel.com ([143.182.124.36]:51438 "EHLO azsmga102.ch.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756101AbZKFGNj (ORCPT ); Fri, 6 Nov 2009 01:13:39 -0500 X-ExtLoop1: 1 Date: Fri, 6 Nov 2009 13:46:46 +0800 From: Yong Wang To: Ingo Molnar Cc: suresh.b.siddha@intel.com, qi.wang@intel.com, linux-kernel@vger.kernel.org Subject: [PATCH] x86, therm: Only read the initial value of thermal LVT entry on BSP Message-ID: <20091106054646.GA26336@ywang-moblin2.bj.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.18 (2008-05-17) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Only read the initial value of thermal LVT entry on BSP. 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 mask bits which are set to 1s when APs receive INIT IPI. It is enough to check only BSP since BIOS is always setting the same value for all threads/cores. Signed-off-by: Yong Wang --- arch/x86/kernel/cpu/mcheck/therm_throt.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c index b3a1dba..69ba972 100644 --- a/arch/x86/kernel/cpu/mcheck/therm_throt.c +++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c @@ -259,6 +259,7 @@ void intel_init_thermal(struct cpuinfo_x86 *c) unsigned int cpu = smp_processor_id(); int tm2 = 0; u32 l, h; + static u32 lvtthmr; /* Thermal monitoring depends on ACPI and clock modulation*/ if (!cpu_has(c, X86_FEATURE_ACPI) || !cpu_has(c, X86_FEATURE_ACC)) @@ -270,7 +271,19 @@ void intel_init_thermal(struct cpuinfo_x86 *c) * since it might be delivered via SMI already: */ rdmsr(MSR_IA32_MISC_ENABLE, l, h); - h = apic_read(APIC_LVTTHMR); + + /* + * Only read the initial value of thermal LVT entry on BSP. 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. + */ + if (cpu == 0) + lvtthmr = apic_read(APIC_LVTTHMR); + + h = lvtthmr; + if ((l & MSR_IA32_MISC_ENABLE_TM1) && (h & APIC_DM_SMI)) { printk(KERN_DEBUG "CPU%d: Thermal monitoring handled by SMI\n", cpu);