Linux kernel -stable discussions
 help / color / mirror / Atom feed
* Patch "KVM: VMX: fix nested vpid for old KVM guests" has been added to the 4.5-stable tree
@ 2016-04-09 18:32 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2016-04-09 18:32 UTC (permalink / raw)
  To: pbonzini, dmatlack, gregkh; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    KVM: VMX: fix nested vpid for old KVM guests

to the 4.5-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-vmx-fix-nested-vpid-for-old-kvm-guests.patch
and it can be found in the queue-4.5 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From ef697a712a6165aea7779c295604b099e8bfae2e Mon Sep 17 00:00:00 2001
From: Paolo Bonzini <pbonzini@redhat.com>
Date: Fri, 18 Mar 2016 16:58:38 +0100
Subject: KVM: VMX: fix nested vpid for old KVM guests

From: Paolo Bonzini <pbonzini@redhat.com>

commit ef697a712a6165aea7779c295604b099e8bfae2e upstream.

Old KVM guests invoke single-context invvpid without actually checking
whether it is supported.  This was fixed by commit 518c8ae ("KVM: VMX:
Make sure single type invvpid is supported before issuing invvpid
instruction", 2010-08-01) and the patch after, but pre-2.6.36
kernels lack it including RHEL 6.

Reported-by: jmontleo@redhat.com
Tested-by: jmontleo@redhat.com
Fixes: 99b83ac893b84ed1a62ad6d1f2b6cc32026b9e85
Reviewed-by: David Matlack <dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 arch/x86/kvm/vmx.c |   14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2702,8 +2702,15 @@ static void nested_vmx_setup_ctls_msrs(s
 	} else
 		vmx->nested.nested_vmx_ept_caps = 0;
 
+	/*
+	 * Old versions of KVM use the single-context version without
+	 * checking for support, so declare that it is supported even
+	 * though it is treated as global context.  The alternative is
+	 * not failing the single-context invvpid, and it is worse.
+	 */
 	if (enable_vpid)
 		vmx->nested.nested_vmx_vpid_caps = VMX_VPID_INVVPID_BIT |
+				VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT |
 				VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT;
 	else
 		vmx->nested.nested_vmx_vpid_caps = 0;
@@ -7474,12 +7481,17 @@ static int handle_invvpid(struct kvm_vcp
 	}
 
 	switch (type) {
+	case VMX_VPID_EXTENT_SINGLE_CONTEXT:
+		/*
+		 * Old versions of KVM use the single-context version so we
+		 * have to support it; just treat it the same as all-context.
+		 */
 	case VMX_VPID_EXTENT_ALL_CONTEXT:
 		__vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
 		nested_vmx_succeed(vcpu);
 		break;
 	default:
-		/* Trap single context invalidation invvpid calls */
+		/* Trap individual address invalidation invvpid calls */
 		BUG_ON(1);
 		break;
 	}


Patches currently in stable-queue which might be from pbonzini@redhat.com are

queue-4.5/kvm-vmx-fix-nested-vpid-for-old-kvm-guests.patch
queue-4.5/kvm-x86-fix-missed-hardware-breakpoints.patch
queue-4.5/kvm-vmx-avoid-guest-hang-on-invalid-invvpid-instruction.patch
queue-4.5/kvm-i8254-change-pit-discard-tick-policy.patch
queue-4.5/kvm-fix-spin_lock_init-order-on-x86.patch
queue-4.5/kvm-vmx-avoid-guest-hang-on-invalid-invept-instruction.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-04-09 18:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-09 18:32 Patch "KVM: VMX: fix nested vpid for old KVM guests" has been added to the 4.5-stable tree gregkh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox