aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvi Kivity <avi@redhat.com>2010-06-23 07:26:18 -0400
committerAvi Kivity <avi@redhat.com>2010-08-01 03:47:19 -0400
commit3e0075094734de122e4cb09f930fa853a3c59f09 (patch)
tree85ba16913603edba8913f31825dff9f13ea0cb4b
parent529df65e394e30a78f2633b575fd81fa5b973e30 (diff)
KVM: Simplify vcpu_enter_guest() mmu reload logic slightly
No need to reload the mmu in between two different vcpu->requests checks. kvm_mmu_reload() may trigger KVM_REQ_TRIPLE_FAULT, but that will be caught during atomic guest entry later. Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
-rw-r--r--arch/x86/kvm/x86.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d39d6b25d3e5..27322d341232 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4616,15 +4616,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
4616 bool req_int_win = !irqchip_in_kernel(vcpu->kvm) && 4616 bool req_int_win = !irqchip_in_kernel(vcpu->kvm) &&
4617 vcpu->run->request_interrupt_window; 4617 vcpu->run->request_interrupt_window;
4618 4618
4619 if (vcpu->requests) 4619 if (vcpu->requests) {
4620 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu)) 4620 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
4621 kvm_mmu_unload(vcpu); 4621 kvm_mmu_unload(vcpu);
4622
4623 r = kvm_mmu_reload(vcpu);
4624 if (unlikely(r))
4625 goto out;
4626
4627 if (vcpu->requests) {
4628 if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu)) 4622 if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu))
4629 __kvm_migrate_timers(vcpu); 4623 __kvm_migrate_timers(vcpu);
4630 if (kvm_check_request(KVM_REQ_KVMCLOCK_UPDATE, vcpu)) 4624 if (kvm_check_request(KVM_REQ_KVMCLOCK_UPDATE, vcpu))
@@ -4649,6 +4643,10 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
4649 } 4643 }
4650 } 4644 }
4651 4645
4646 r = kvm_mmu_reload(vcpu);
4647 if (unlikely(r))
4648 goto out;
4649
4652 preempt_disable(); 4650 preempt_disable();
4653 4651
4654 kvm_x86_ops->prepare_guest_switch(vcpu); 4652 kvm_x86_ops->prepare_guest_switch(vcpu);