Skip to contentSkip to conversation

KVM: nVMX: Clear segment cache after switching between L1 and L2

PATCH Applied Jan Kiszka 2 participants 2 messages Feb 23, 2013 – Feb 27, 2013

Subsystems (3)
lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 KVM: nVMX: Clear segment cache after switching between L1 and L2

From: Jan Kiszka <[email protected]>

Switching the VMCS obviously invalidates what may have been cached about the guest segments.

---

Probably, the missing invalidations are harmless ATM, but you never know.

 arch/x86/kvm/vmx.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +4 -0
index 94f3b66..d45f0e0 100644
@@ -7236,6 +7236,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
 	vcpu->cpu = cpu;
 	put_cpu();
 
+	vmx_segment_cache_clear(vmx);
+
 	vmcs12->launch_state = 1;
 
 	prepare_vmcs02(vcpu, vmcs12);
@@ -7504,6 +7506,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
 	vcpu->cpu = cpu;
 	put_cpu();
 
+	vmx_segment_cache_clear(vmx);
+
 	/* if no vmcs02 cache requested, remove the one we used */
 	if (VMCS02_POOL_SIZE == 0)
 		nested_free_vmcs02(vmx, vmx->nested.current_vmptr);
Signature · 1 line
1.7.3.4
Applied
#1 lore raw
Quoted 6 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

Switching the VMCS obviously invalidates what may have been cached about the guest segments.

Applied, thanks.

Quoted 32 lines

---

Probably, the missing invalidations are harmless ATM, but you never know.

 arch/x86/kvm/vmx.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
arch/x86/kvm/vmx.c +4 -0
index 94f3b66..d45f0e0 100644
@@ -7236,6 +7236,8 @@ static int nested_vmx_run(struct kvm_vcpu *vcpu, bool launch)
 	vcpu->cpu = cpu;
 	put_cpu();
 
+	vmx_segment_cache_clear(vmx);
+
 	vmcs12->launch_state = 1;
 
 	prepare_vmcs02(vcpu, vmcs12);
@@ -7504,6 +7506,8 @@ static void nested_vmx_vmexit(struct kvm_vcpu *vcpu)
 	vcpu->cpu = cpu;
 	put_cpu();
 
+	vmx_segment_cache_clear(vmx);
+
 	/* if no vmcs02 cache requested, remove the one we used */
 	if (VMCS02_POOL_SIZE == 0)
 		nested_free_vmcs02(vmx, vmx->nested.current_vmptr);
Signature · 1 line
1.7.3.4

--
Gleb.