From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Luis R. Rodriguez" <mcgrof@do-not-panic.com>,
xen-devel@lists.xenproject.org
Cc: jgross@suse.com, mcgrof@suse.com, david.vrabel@citrix.com,
boris.ostrovsky@oracle.com,
"Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [RFT] x86/pvh: disable all MTRR CPU features on cpuid for dom0
Date: Fri, 27 Mar 2015 09:37:52 +0000 [thread overview]
Message-ID: <551524F0.3010507@citrix.com> (raw)
In-Reply-To: <1427412834-4624-1-git-send-email-mcgrof@do-not-panic.com>
On 26/03/15 23:33, Luis R. Rodriguez wrote:
> From: "Luis R. Rodriguez" <mcgrof@suse.com>
>
> Commit 586ab6a by Roger disabled the main MTRR CPU feature
> on the cpuid when on pvh in order to avoid having MTRR code
> run on the OS on dom0. This missed the fact that not all CPUs
> use this cpuid to identify MTRR support, this complets that.
>
> This could in theory fix some potential issues where MTRR
> code was previously enabled, for instance running cat /proc/mtrr
> on a Linux system where MTRR was actually disabled.
>
> Cc: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com>
> ---
>
> Konrad asked me to submit this. I don't have time to test this
> though so it goes as RFT. If it clears through the flames of
> xen testing thunder please consider merging.
>
> xen/arch/x86/traps.c | 6 ++++++
> xen/include/asm-x86/cpufeature.h | 3 +++
> 2 files changed, 9 insertions(+)
>
> diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
> index ec324b0..23c3bbc 100644
> --- a/xen/arch/x86/traps.c
> +++ b/xen/arch/x86/traps.c
> @@ -888,7 +888,13 @@ void pv_cpuid(struct cpu_user_regs *regs)
> __clear_bit(X86_FEATURE_ACC, &d);
> __clear_bit(X86_FEATURE_PBE, &d);
> if ( is_pvh_vcpu(curr) )
> + {
> __clear_bit(X86_FEATURE_MTRR, &d);
> + __clear_bit(X86_FEATURE_K6_MTRR, &d);
> + __clear_bit(X86_FEATURE_CENTAUR_MCR, &d);
> + __clear_bit(X86_FEATURE_CYRIX_ARR, &d);
> + }
> +
>
> __clear_bit(X86_FEATURE_DTES64 % 32, &c);
> __clear_bit(X86_FEATURE_MWAIT % 32, &c);
> diff --git a/xen/include/asm-x86/cpufeature.h b/xen/include/asm-x86/cpufeature.h
> index 7963a3a..2ce5c7c 100644
> --- a/xen/include/asm-x86/cpufeature.h
> +++ b/xen/include/asm-x86/cpufeature.h
> @@ -61,6 +61,9 @@
>
> /* Other features, Linux-defined mapping, word 3 */
> /* This range is used for feature bits which conflict or are synthesized */
> +#define X86_FEATURE_K6_MTRR (3*32+ 1) /* AMD K6 nonstandard MTRRs */
> +#define X86_FEATURE_CYRIX_ARR (3*32+ 2) /* Cyrix ARRs (= MTRRs) */
> +#define X86_FEATURE_CENTAUR_MCR (3*32+ 3) /* Centaur MCRs (= MTRRs) */
You are introducing 3 new defines, so you can clear them out of a word.
Under what circumstances would these bits will ever be set in the first
place?
~Andrew
> #define X86_FEATURE_CONSTANT_TSC (3*32+ 8) /* TSC ticks at a constant rate */
> #define X86_FEATURE_NONSTOP_TSC (3*32+ 9) /* TSC does not stop in C states */
> #define X86_FEATURE_ARAT (3*32+ 10) /* Always running APIC timer */
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2015-03-27 9:38 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-26 23:33 [RFT] x86/pvh: disable all MTRR CPU features on cpuid for dom0 Luis R. Rodriguez
2015-03-27 8:32 ` Roger Pau Monné
2015-03-27 18:08 ` Luis R. Rodriguez
2015-03-27 9:37 ` Andrew Cooper [this message]
2015-03-27 10:33 ` 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=551524F0.3010507@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=boris.ostrovsky@oracle.com \
--cc=david.vrabel@citrix.com \
--cc=jgross@suse.com \
--cc=mcgrof@do-not-panic.com \
--cc=mcgrof@suse.com \
--cc=roger.pau@citrix.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.