aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorJunaid Shahid <junaids@google.com>2018-06-27 17:59:11 -0400
committerPaolo Bonzini <pbonzini@redhat.com>2018-08-06 11:58:54 -0400
commit50c28f21d045dde8c52548f8482d456b3f0956f5 (patch)
treef0c046a9dfba1a1b0aec3b286faed82df10dc92e /virt/kvm
parent1c53da3fa3a333eb15ee5a154700e75d135c21c8 (diff)
kvm: x86: Use fast CR3 switch for nested VMX
Use the fast CR3 switch mechanism to locklessly change the MMU root page when switching between L1 and L2. The switch from L2 to L1 should always go through the fast path, while the switch from L1 to L2 should go through the fast path if L1's CR3/EPTP for L2 hasn't changed since the last time. Signed-off-by: Junaid Shahid <junaids@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index f519eb8d06b1..8f461e0ed382 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2127,16 +2127,22 @@ static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
2127 2127
2128static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu) 2128static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu)
2129{ 2129{
2130 int ret = -EINTR;
2131 int idx = srcu_read_lock(&vcpu->kvm->srcu);
2132
2130 if (kvm_arch_vcpu_runnable(vcpu)) { 2133 if (kvm_arch_vcpu_runnable(vcpu)) {
2131 kvm_make_request(KVM_REQ_UNHALT, vcpu); 2134 kvm_make_request(KVM_REQ_UNHALT, vcpu);
2132 return -EINTR; 2135 goto out;
2133 } 2136 }
2134 if (kvm_cpu_has_pending_timer(vcpu)) 2137 if (kvm_cpu_has_pending_timer(vcpu))
2135 return -EINTR; 2138 goto out;
2136 if (signal_pending(current)) 2139 if (signal_pending(current))
2137 return -EINTR; 2140 goto out;
2138 2141
2139 return 0; 2142 ret = 0;
2143out:
2144 srcu_read_unlock(&vcpu->kvm->srcu, idx);
2145 return ret;
2140} 2146}
2141 2147
2142/* 2148/*