From patchwork Wed Mar 23 02:24:43 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Len Brown X-Patchwork-Id: 654131 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2N2TDBt022715 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Wed, 23 Mar 2011 02:29:35 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2N2Pjeq025856; Tue, 22 Mar 2011 19:26:15 -0700 Received: from vms173001pub.verizon.net (vms173001pub.verizon.net [206.46.173.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p2N2PDIQ025816 for ; Tue, 22 Mar 2011 19:25:14 -0700 Received: from localhost.localdomain ([unknown] [74.104.148.74]) by vms173001.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LIH00DZEO1AAOJ3@vms173001.mailsrvcs.net> for linux-pm@lists.linux-foundation.org; Tue, 22 Mar 2011 21:24:58 -0500 (CDT) Received: from localhost.localdomain (x980 [127.0.0.1]) by localhost.localdomain (8.14.4/8.14.4) with ESMTP id p2N2OiRP010508; Tue, 22 Mar 2011 22:24:45 -0400 Received: from localhost (lenb@localhost) by localhost.localdomain (8.14.4/8.14.4/Submit) with ESMTP id p2N2OhhR010504; Tue, 22 Mar 2011 22:24:43 -0400 X-Authentication-warning: localhost.localdomain: lenb owned process doing -bs Date: Tue, 22 Mar 2011 22:24:43 -0400 (EDT) From: Len Brown X-X-Sender: lenb@x980 To: stable@kernel.org Message-id: User-Agent: Alpine 2.02 (LFD 1266 2009-07-14) MIME-version: 1.0 Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-4.289 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 Cc: linux-pm@lists.linux-foundation.org Subject: [linux-pm] [PATCH 1/2 2.6.37.stable] intel_idle: disable NHM/WSM HW C-state auto-demotion X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 23 Mar 2011 02:29:58 +0000 (UTC) Index: linux-2.6.37.y/arch/x86/include/asm/msr-index.h =================================================================== --- linux-2.6.37.y.orig/arch/x86/include/asm/msr-index.h +++ linux-2.6.37.y/arch/x86/include/asm/msr-index.h @@ -36,6 +36,10 @@ #define MSR_IA32_PERFCTR1 0x000000c2 #define MSR_FSB_FREQ 0x000000cd +#define MSR_NHM_SNB_PKG_CST_CFG_CTL 0x000000e2 +#define NHM_C3_AUTO_DEMOTE (1UL << 25) +#define NHM_C1_AUTO_DEMOTE (1UL << 26) + #define MSR_MTRRcap 0x000000fe #define MSR_IA32_BBL_CR_CTL 0x00000119 Index: linux-2.6.37.y/drivers/idle/intel_idle.c =================================================================== --- linux-2.6.37.y.orig/drivers/idle/intel_idle.c +++ linux-2.6.37.y/drivers/idle/intel_idle.c @@ -62,6 +62,7 @@ #include #include #include +#include #define INTEL_IDLE_VERSION "0.4" #define PREFIX "intel_idle: " @@ -85,6 +86,12 @@ static int intel_idle(struct cpuidle_dev static struct cpuidle_state *cpuidle_state_table; /* + * Hardware C-state auto-demotion may not always be optimal. + * Indicate which enable bits to clear here. + */ +static unsigned long long auto_demotion_disable_flags; + +/* * States are indexed by the cstate number, * which is also the index into the MWAIT hint array. * Thus C0 is a dummy. @@ -276,6 +283,15 @@ static struct notifier_block setup_broad .notifier_call = setup_broadcast_cpuhp_notify, }; +static void auto_demotion_disable(void *dummy) +{ + unsigned long long msr_bits; + + rdmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); + msr_bits &= ~auto_demotion_disable_flags; + wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); +} + /* * intel_idle_probe() */ @@ -319,6 +335,8 @@ static int intel_idle_probe(void) case 0x25: /* Westmere */ case 0x2C: /* Westmere */ cpuidle_state_table = nehalem_cstates; + auto_demotion_disable_flags = + (NHM_C1_AUTO_DEMOTE | NHM_C3_AUTO_DEMOTE); break; case 0x1C: /* 28 - Atom Processor */ @@ -431,6 +449,8 @@ static int intel_idle_cpuidle_devices_in return -EIO; } } + if (auto_demotion_disable_flags) + smp_call_function(auto_demotion_disable, NULL, 1); return 0; }