kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: x86: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN
@ 2019-07-08 16:47 Wei Yang
  2019-07-09 14:56 ` Sean Christopherson
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yang @ 2019-07-08 16:47 UTC (permalink / raw)
  To: kvm; +Cc: pbonzini

move guest_exit() after local_irq_eanbled() so that the timer interrupt
hits we account that tick as spent in the guest.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Wei Yang <w90p710@gmail.com>
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 2e302e977dac..04a2913f9226 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -8044,7 +8044,6 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 
 	++vcpu->stat.exits;
 
-	guest_exit_irqoff();
 	if (lapic_in_kernel(vcpu)) {
 		s64 delta = vcpu->arch.apic->lapic_timer.advance_expire_delta;
 		if (delta != S64_MIN) {
@@ -8054,6 +8053,7 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
 	}
 
 	local_irq_enable();
+	guest_exit();
 	preempt_enable();
 
 	vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
-- 
2.14.1.40.g8e62ba1


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

end of thread, other threads:[~2019-07-10 16:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-08 16:47 [PATCH] KVM: x86: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN Wei Yang
2019-07-09 14:56 ` Sean Christopherson
     [not found]   ` <CANwVFYMwKqsvGhPS7ZpQRS-dJ58KMLRSx8oEk_PowMtwpfXK=A@mail.gmail.com>
2019-07-10 16:05     ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).