xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: gang.wei@intel.com, JBeulich@suse.com,
	xen-devel@lists.xenproject.org, andrew.cooper3@citrix.com,
	ian.campbell@citrix.com, keir@xen.org, tim@xen.org
Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: [PATCH RFC] x86: Limit MSR_IA32_THERM_CONTROL and MSR_IA32_ENERGY_PERF_BIAS
Date: Fri, 18 Dec 2015 15:46:46 -0500	[thread overview]
Message-ID: <1450471606-19129-2-git-send-email-konrad.wilk@oracle.com> (raw)
In-Reply-To: <1450471606-19129-1-git-send-email-konrad.wilk@oracle.com>

Those two allow the OS pinned dom0 to change the T-state
(throttling) behind the Xen cpufreq code.

The patch that introduced this: f78e2193b6409577314167ed9e077de7ac3e652f

    x86: Enable THERM_CONTROL_MSR write for dom0 even when cpufreq=xen

    Signed-off-by: Wei Gang <gang.wei@intel.com>
    Signed-off-by: Keir Fraser <keir.fraser@citrix.com>

is very lacking on details.

Anyhow this patch in effect reverts the above commit. It is also
lacking in details :-)

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
---
 xen/arch/x86/traps.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index e105b95..78395ef 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -2614,23 +2614,15 @@ static int emulate_privileged_op(struct cpu_user_regs *regs)
                 goto fail;
             break;
         case MSR_IA32_PERF_CTL:
-            if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
-                goto fail;
-            if ( !is_cpufreq_controller(currd) )
-                break;
-            if ( wrmsr_safe(regs->ecx, msr_content) != 0 )
-                goto fail;
-            break;
         case MSR_IA32_THERM_CONTROL:
         case MSR_IA32_ENERGY_PERF_BIAS:
             if ( boot_cpu_data.x86_vendor != X86_VENDOR_INTEL )
                 goto fail;
-            if ( !is_hardware_domain(currd) || !is_pinned_vcpu(v) )
+            if ( !is_cpufreq_controller(currd) )
                 break;
             if ( wrmsr_safe(regs->ecx, msr_content) != 0 )
                 goto fail;
             break;
-
         case MSR_AMD64_DR0_ADDRESS_MASK:
             if ( !boot_cpu_has(X86_FEATURE_DBEXT) || (msr_content >> 32) )
                 goto fail;
-- 
2.1.0

  reply	other threads:[~2015-12-18 20:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18 20:46 [RFC PATCH] THERM_CONTROL_MSR mucks with Xen cpufreq code Konrad Rzeszutek Wilk
2015-12-18 20:46 ` Konrad Rzeszutek Wilk [this message]
2015-12-18 21:31   ` [PATCH RFC] x86: Limit MSR_IA32_THERM_CONTROL and MSR_IA32_ENERGY_PERF_BIAS Andrew Cooper
2015-12-21 11:39     ` Jan Beulich
2015-12-21 11:42   ` Jan Beulich

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=1450471606-19129-2-git-send-email-konrad.wilk@oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=gang.wei@intel.com \
    --cc=ian.campbell@citrix.com \
    --cc=keir@xen.org \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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;
as well as URLs for NNTP newsgroup(s).