From: "Jan Beulich" Subject: Re: [PATCH 1/2] mwait_idle: Disable Baytrail Core and Module C6 auto-demotion Date: Mon, 08 Sep 2014 14:22:26 +0100 Message-ID: <540DC9B20200007800031FDD@mail.emea.novell.com> References: <1410180127-4812-1-git-send-email-ross.lagerwall@citrix.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part1E2B4A82.1__=" Return-path: In-Reply-To: <1410180127-4812-1-git-send-email-ross.lagerwall@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ross Lagerwall Cc: Keir Fraser , Xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part1E2B4A82.1__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline >>> On 08.09.14 at 14:42, wrote: > From: Len Brown >=20 > Power efficiency improves on Baytrail (Intel Atom Processor E3000) > when C6 auto-demotion is disabled. >=20 > Based on work by Srinidhi Kasagar . >=20 > Signed-off-by: Len Brown > Signed-off-by: Ross Lagerwall So we raced on pulling these over - I did so late last week too and just didn't get to send them out yet. On this one I in fact doubt (and sent a respective query to Len; no response yet) that the MSR handling is. Hence my ported over patch is a little different: x86/mwait-idle: disable Baytrail Core and Module C6 auto-demotion Power efficiency improves on Baytrail (Intel Atom Processor E3000) when Linux disables C6 auto-demotion. Based on work by Srinidhi Kasagar . Signed-off-by: Len Brown Do the MSR writes on all CPUs rather than just the current one. Signed-off-by: Jan Beulich --- a/xen/include/asm-x86/msr-index.h +++ b/xen/include/asm-x86/msr-index.h @@ -483,4 +483,7 @@ #define _MSR_MISC_FEATURES_CPUID_FAULTING 0 #define MSR_MISC_FEATURES_CPUID_FAULTING (1ULL << _MSR_MISC_FEATURES= _CPUID_FAULTING) =20 +#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668 +#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669 + #endif /* __ASM_MSR_INDEX_H */ --- a/xen/arch/x86/cpu/mwait-idle.c +++ b/xen/arch/x86/cpu/mwait-idle.c @@ -88,6 +88,7 @@ struct idle_cpu { * Indicate which enable bits to clear here. */ unsigned long auto_demotion_disable_flags; + bool_t byt_auto_demotion_disable_flag; bool_t disable_promotion_to_c1e; }; =20 @@ -539,6 +540,12 @@ static void auto_demotion_disable(void * wrmsrl(MSR_NHM_SNB_PKG_CST_CFG_CTL, msr_bits); } =20 +static void byt_auto_demotion_disable(void *dummy) +{ + wrmsrl(MSR_CC6_DEMOTION_POLICY_CONFIG, 0); + wrmsrl(MSR_MC6_DEMOTION_POLICY_CONFIG, 0); +} + static void c1e_promotion_disable(void *dummy) { u64 msr_bits; @@ -571,6 +578,7 @@ static const struct idle_cpu idle_cpu_sn static const struct idle_cpu idle_cpu_byt =3D { .state_table =3D byt_cstates, .disable_promotion_to_c1e =3D 1, + .byt_auto_demotion_disable_flag =3D 1, }; =20 static const struct idle_cpu idle_cpu_ivb =3D { @@ -769,6 +777,9 @@ static int mwait_idle_cpu_init(struct no if (icpu->auto_demotion_disable_flags) on_selected_cpus(cpumask_of(cpu), auto_demotion_disable, = NULL, 1); =20 + if (icpu->byt_auto_demotion_disable_flag) + on_selected_cpus(cpumask_of(cpu), byt_auto_demotion_disable= , NULL, 1); + if (icpu->disable_promotion_to_c1e) on_selected_cpus(cpumask_of(cpu), c1e_promotion_disable, = NULL, 1); =20 --=__Part1E2B4A82.1__= Content-Type: text/plain; name="x86-mwait-idle-Baytrail-no-demotion.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-mwait-idle-Baytrail-no-demotion.patch" x86/mwait-idle: disable Baytrail Core and Module C6 auto-demotion=0A=0APowe= r efficiency improves on Baytrail (Intel Atom Processor E3000)=0Awhen = Linux disables C6 auto-demotion.=0A=0ABased on work by Srinidhi Kasagar = .=0A=0ASigned-off-by: Len Brown =0A=0ADo the MSR writes on all CPUs rather than just the current = one.=0A=0ASigned-off-by: Jan Beulich =0A=0A--- = a/xen/include/asm-x86/msr-index.h=0A+++ b/xen/include/asm-x86/msr-index.h= =0A@@ -483,4 +483,7 @@=0A #define _MSR_MISC_FEATURES_CPUID_FAULTING = 0=0A #define MSR_MISC_FEATURES_CPUID_FAULTING (1ULL << _MSR_MISC_FEATURES= _CPUID_FAULTING)=0A =0A+#define MSR_CC6_DEMOTION_POLICY_CONFIG 0x00000668= =0A+#define MSR_MC6_DEMOTION_POLICY_CONFIG 0x00000669=0A+=0A #endif = /* __ASM_MSR_INDEX_H */=0A--- a/xen/arch/x86/cpu/mwait-idle.c=0A+++ = b/xen/arch/x86/cpu/mwait-idle.c=0A@@ -88,6 +88,7 @@ struct idle_cpu {=0A = * Indicate which enable bits to clear here.=0A */=0A unsigned = long auto_demotion_disable_flags;=0A+ bool_t byt_auto_demotion_disable_fl= ag;=0A bool_t disable_promotion_to_c1e;=0A };=0A =0A@@ -539,6 +540,12 @@ = static void auto_demotion_disable(void *=0A wrmsrl(MSR_NHM_SNB_PKG_CST_= CFG_CTL, msr_bits);=0A }=0A =0A+static void byt_auto_demotion_disable(void = *dummy)=0A+{=0A+ wrmsrl(MSR_CC6_DEMOTION_POLICY_CONFIG, 0);=0A+ = wrmsrl(MSR_MC6_DEMOTION_POLICY_CONFIG, 0);=0A+}=0A+=0A static void = c1e_promotion_disable(void *dummy)=0A {=0A u64 msr_bits;=0A@@ -571,6 = +578,7 @@ static const struct idle_cpu idle_cpu_sn=0A static const struct = idle_cpu idle_cpu_byt =3D {=0A .state_table =3D byt_cstates,=0A = .disable_promotion_to_c1e =3D 1,=0A+ .byt_auto_demotion_disable_flag = =3D 1,=0A };=0A =0A static const struct idle_cpu idle_cpu_ivb =3D {=0A@@ = -769,6 +777,9 @@ static int mwait_idle_cpu_init(struct no=0A if = (icpu->auto_demotion_disable_flags)=0A on_selected_cpus(cpumask_of= (cpu), auto_demotion_disable, NULL, 1);=0A =0A+ if (icpu->byt_auto_demotion= _disable_flag)=0A+ on_selected_cpus(cpumask_of(cpu), = byt_auto_demotion_disable, NULL, 1);=0A+=0A if (icpu->disable_promotion= _to_c1e)=0A on_selected_cpus(cpumask_of(cpu), c1e_promotion_dis= able, NULL, 1);=0A =0A --=__Part1E2B4A82.1__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part1E2B4A82.1__=--