diff mbox

[2/2] KVM: nVMX: fix flush vpid01 during nested vmentry/vmexit

Message ID BLU437-SMTP87990F7C1AA6028BBAB2880440@phx.gbl (mailing list archive)
State New, archived
Headers show

Commit Message

Wanpeng Li Sept. 23, 2015, 10:26 a.m. UTC
vpid_sync_vcpu_single() still handles vpid01 during nested 
vmentry/vmexit since vmx->vpid is used for invvpid. This 
patch fix it by specific the vpid02 through __vmx_flush_tlb() 
to flush the right vpid.

Signed-off-by: Wanpeng Li <wanpeng.li@hotmail.com>
---
 arch/x86/kvm/vmx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 7188c5e..31fb631 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -7207,7 +7207,7 @@  static int handle_invvpid(struct kvm_vcpu *vcpu)
 	case VMX_VPID_EXTENT_INDIVIDUAL_ADDR:
 	case VMX_VPID_EXTENT_SINGLE_CONTEXT:
 	case VMX_VPID_EXTENT_ALL_CONTEXT:
-		vmx_flush_tlb(vcpu);
+		__vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
 		nested_vmx_succeed(vcpu);
 		break;
 	default:
@@ -9501,7 +9501,7 @@  static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12)
 			vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02);
 			if (vmcs12->virtual_processor_id != vmx->nested.last_vpid) {
 				vmx->nested.last_vpid = vmcs12->virtual_processor_id;
-				vmx_flush_tlb(vcpu);
+				__vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02);
 			}
 		} else {
 			vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid);