From: Paolo Bonzini <pbonzini@redhat.com>
To: speck@linutronix.de
Subject: [MODERATED] Re: ***UNCHECKED*** [PATCH v7 3/5] NX 3
Date: Fri, 25 Oct 2019 10:48:04 +0200 [thread overview]
Message-ID: <a5f3f0dd-2eb8-6bf7-ae08-6bb45e8a4c68@redhat.com> (raw)
In-Reply-To: <20191025083739.GC7069@suse.de>
[-- Attachment #1: Type: text/plain, Size: 1661 bytes --]
On 25/10/19 10:37, speck for Joerg Roedel wrote:
> I fixed it with this diff:
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index e7970a2e8eae..6e9380a0ca41 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -997,7 +997,7 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
> * On CPUs that support "load IA32_EFER", always switch EFER
> * atomically, since it's faster than switching it manually.
> */
> - if (cpu_has_load_ia32_efer() ||
> + if ((cpu_has_load_ia32_efer() && (guest_efer & EFER_NX)) ||
> (enable_ept && ((vmx->vcpu.arch.efer ^ host_efer) & EFER_NX))) {
> if (!(guest_efer & EFER_LMA))
> guest_efer &= ~EFER_LME;
>
What about this instead (completely untested):
diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
index e7970a2e8eae..1f923dee99e5 100644
--- a/arch/x86/kvm/vmx/vmx.c
+++ b/arch/x86/kvm/vmx/vmx.c
@@ -992,6 +992,9 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
ignore_bits &= ~(u64)EFER_SCE;
#endif
+ guest_efer &= ~ignore_bits;
+ guest_efer |= host_efer & ignore_bits;
+
/*
* On EPT, we can't emulate NX, so we must switch EFER atomically.
* On CPUs that support "load IA32_EFER", always switch EFER
@@ -1010,9 +1013,6 @@ static bool update_transition_efer(struct vcpu_vmx *vmx, int efer_offset)
} else {
clear_atomic_switch_msr(vmx, MSR_EFER);
- guest_efer &= ~ignore_bits;
- guest_efer |= host_efer & ignore_bits;
-
vmx->guest_msrs[efer_offset].data = guest_efer;
vmx->guest_msrs[efer_offset].mask = ~ignore_bits;
next prev parent reply other threads:[~2019-10-25 8:48 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-24 16:34 [MODERATED] [PATCH v7 0/5] NX 0 Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 1/5] NX 1 Paolo Bonzini
2019-10-30 18:38 ` [MODERATED] " Josh Poimboeuf
2019-10-31 11:05 ` Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 2/5] NX 2 Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 3/5] NX 3 Paolo Bonzini
2019-10-25 8:37 ` [MODERATED] Re: ***UNCHECKED*** " Joerg Roedel
2019-10-25 8:48 ` Paolo Bonzini [this message]
2019-10-25 9:03 ` [MODERATED] Re: ***UNCHECKED*** " Joerg Roedel
2019-10-25 9:08 ` Paolo Bonzini
2019-10-25 9:45 ` [MODERATED] Re: ***UNCHECKED*** " Joerg Roedel
2019-10-25 10:39 ` Paolo Bonzini
2019-10-29 20:33 ` mark gross
2019-10-31 11:02 ` Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 4/5] NX 4 Paolo Bonzini
2019-10-24 16:34 ` [MODERATED] [PATCH v7 5/5] NX 5 Paolo Bonzini
2019-10-24 18:27 ` [MODERATED] Re: [PATCH v7 0/5] NX 0 Ben Hutchings
2019-10-24 18:56 ` 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=a5f3f0dd-2eb8-6bf7-ae08-6bb45e8a4c68@redhat.com \
--to=pbonzini@redhat.com \
--cc=speck@linutronix.de \
/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.