From: Paolo Bonzini <pbonzini@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>,
"'kvm@vger.kernel.org'" <kvm@vger.kernel.org>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
"'qemu-devel@nongnu.org'" <qemu-devel@nongnu.org>
Subject: Re: [PATCH] KVM: x86: Work around buggy MPX platform
Date: Mon, 10 Mar 2014 09:53:57 +0100 [thread overview]
Message-ID: <531D7DA5.4020002@redhat.com> (raw)
In-Reply-To: <DE8DF0795D48FD4CA783C40EC82923350155757D@SHSMSX152.ccr.corp.intel.com>
Il 10/03/2014 09:48, Liu, Jinsong ha scritto:
> From 5854070994c5002b3a37577165ed3e82f36f712d Mon Sep 17 00:00:00 2001
> From: Liu Jinsong <jinsong.liu@intel.com>
> Date: Sat, 8 Mar 2014 04:40:02 +0800
> Subject: [PATCH] KVM: x86: Work around buggy MPX platform
>
> Work around buggy MPX platform which support MSR_IA32_BNDCFGS
> but has issue at, say, VMX ucode.
>
> Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
> ---
> arch/x86/kvm/x86.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 1e91a24..1fc184d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3936,6 +3936,16 @@ static void kvm_init_msr_list(void)
> for (i = j = KVM_SAVE_MSRS_BEGIN; i < ARRAY_SIZE(msrs_to_save); i++) {
> if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0)
> continue;
> +
> + /*
> + * Work around some buggy MPX platform which support
> + * MSR_IA32_BNDCFGS but has issue at, say, VMX ucode.
> + */
> + if ((msrs_to_save[i] == MSR_IA32_BNDCFGS) &&
Too many parentheses in this "if".
> + (kvm_x86_ops->mpx_supported ?
> + !kvm_x86_ops->mpx_supported() : 1))
Better: "!kvm_x86_ops->mpx_supported || !kvm_x86_ops->mpx_supported()"
but I'm leaning towards adding an implementation of mpx_supported to SVM
too (it will always return false).
> + continue;
> +
> if (j < i)
> msrs_to_save[j] = msrs_to_save[i];
> j++;
> @@ -5576,9 +5586,11 @@ int kvm_arch_init(void *opaque)
> goto out_free_percpu;
>
> kvm_set_mmio_spte_mask();
> - kvm_init_msr_list();
>
> kvm_x86_ops = ops;
> +
> + kvm_init_msr_list();
> +
> kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
> PT_DIRTY_MASK, PT64_NX_MASK, 0);
>
>
Thanks Liu. Indeed I could not reproduce Robert's issue, though it
might be possible to get it with nested virtualization. I'll send a
similar patch that I was testing.
Paolo
WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Liu, Jinsong" <jinsong.liu@intel.com>,
"'kvm@vger.kernel.org'" <kvm@vger.kernel.org>,
"'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>,
"'qemu-devel@nongnu.org'" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] KVM: x86: Work around buggy MPX platform
Date: Mon, 10 Mar 2014 09:53:57 +0100 [thread overview]
Message-ID: <531D7DA5.4020002@redhat.com> (raw)
In-Reply-To: <DE8DF0795D48FD4CA783C40EC82923350155757D@SHSMSX152.ccr.corp.intel.com>
Il 10/03/2014 09:48, Liu, Jinsong ha scritto:
> From 5854070994c5002b3a37577165ed3e82f36f712d Mon Sep 17 00:00:00 2001
> From: Liu Jinsong <jinsong.liu@intel.com>
> Date: Sat, 8 Mar 2014 04:40:02 +0800
> Subject: [PATCH] KVM: x86: Work around buggy MPX platform
>
> Work around buggy MPX platform which support MSR_IA32_BNDCFGS
> but has issue at, say, VMX ucode.
>
> Signed-off-by: Liu Jinsong <jinsong.liu@intel.com>
> ---
> arch/x86/kvm/x86.c | 14 +++++++++++++-
> 1 files changed, 13 insertions(+), 1 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 1e91a24..1fc184d 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -3936,6 +3936,16 @@ static void kvm_init_msr_list(void)
> for (i = j = KVM_SAVE_MSRS_BEGIN; i < ARRAY_SIZE(msrs_to_save); i++) {
> if (rdmsr_safe(msrs_to_save[i], &dummy[0], &dummy[1]) < 0)
> continue;
> +
> + /*
> + * Work around some buggy MPX platform which support
> + * MSR_IA32_BNDCFGS but has issue at, say, VMX ucode.
> + */
> + if ((msrs_to_save[i] == MSR_IA32_BNDCFGS) &&
Too many parentheses in this "if".
> + (kvm_x86_ops->mpx_supported ?
> + !kvm_x86_ops->mpx_supported() : 1))
Better: "!kvm_x86_ops->mpx_supported || !kvm_x86_ops->mpx_supported()"
but I'm leaning towards adding an implementation of mpx_supported to SVM
too (it will always return false).
> + continue;
> +
> if (j < i)
> msrs_to_save[j] = msrs_to_save[i];
> j++;
> @@ -5576,9 +5586,11 @@ int kvm_arch_init(void *opaque)
> goto out_free_percpu;
>
> kvm_set_mmio_spte_mask();
> - kvm_init_msr_list();
>
> kvm_x86_ops = ops;
> +
> + kvm_init_msr_list();
> +
> kvm_mmu_set_mask_ptes(PT_USER_MASK, PT_ACCESSED_MASK,
> PT_DIRTY_MASK, PT64_NX_MASK, 0);
>
>
Thanks Liu. Indeed I could not reproduce Robert's issue, though it
might be possible to get it with nested virtualization. I'll send a
similar patch that I was testing.
Paolo
next prev parent reply other threads:[~2014-03-10 8:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 8:48 [PATCH] KVM: x86: Work around buggy MPX platform Liu, Jinsong
2014-03-10 8:48 ` [Qemu-devel] " Liu, Jinsong
2014-03-10 8:53 ` Paolo Bonzini [this message]
2014-03-10 8:53 ` Paolo Bonzini
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=531D7DA5.4020002@redhat.com \
--to=pbonzini@redhat.com \
--cc=jinsong.liu@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=qemu-devel@nongnu.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.