All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: Simplify vcpu_enter_guest() mmu reload logic slightly
@ 2010-06-23 11:26 Avi Kivity
  2010-06-28 15:26 ` Marcelo Tosatti
  0 siblings, 1 reply; 2+ messages in thread
From: Avi Kivity @ 2010-06-23 11:26 UTC (permalink / raw)
  To: Marcelo Tosatti, kvm

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>
---
 arch/x86/kvm/x86.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d0b9252..ae2e282 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4606,15 +4606,9 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 	bool req_int_win = !irqchip_in_kernel(vcpu->kvm) &&
 		vcpu->run->request_interrupt_window;
 
-	if (vcpu->requests)
+	if (vcpu->requests) {
 		if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
 			kvm_mmu_unload(vcpu);
-
-	r = kvm_mmu_reload(vcpu);
-	if (unlikely(r))
-		goto out;
-
-	if (vcpu->requests) {
 		if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu))
 			__kvm_migrate_timers(vcpu);
 		if (kvm_check_request(KVM_REQ_KVMCLOCK_UPDATE, vcpu))
@@ -4639,6 +4633,10 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 		}
 	}
 
+	r = kvm_mmu_reload(vcpu);
+	if (unlikely(r))
+		goto out;
+
 	preempt_disable();
 
 	kvm_x86_ops->prepare_guest_switch(vcpu);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] KVM: Simplify vcpu_enter_guest() mmu reload logic slightly
  2010-06-23 11:26 [PATCH] KVM: Simplify vcpu_enter_guest() mmu reload logic slightly Avi Kivity
@ 2010-06-28 15:26 ` Marcelo Tosatti
  0 siblings, 0 replies; 2+ messages in thread
From: Marcelo Tosatti @ 2010-06-28 15:26 UTC (permalink / raw)
  To: Avi Kivity; +Cc: kvm

On Wed, Jun 23, 2010 at 02:26:18PM +0300, Avi Kivity wrote:
> 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>
> ---
>  arch/x86/kvm/x86.c |   12 +++++-------
>  1 files changed, 5 insertions(+), 7 deletions(-)

Applied, thanks.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-28 16:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-23 11:26 [PATCH] KVM: Simplify vcpu_enter_guest() mmu reload logic slightly Avi Kivity
2010-06-28 15:26 ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.