From: Wei Yang <w90p710@gmail.com>
To: kvm@vger.kernel.org
Cc: pbonzini@redhat.com
Subject: [PATCH] KVM: x86: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN
Date: Tue, 9 Jul 2019 00:47:51 +0800 [thread overview]
Message-ID: <20190708164751.88385-1-w90p710@gmail.com> (raw)
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
next reply other threads:[~2019-07-08 16:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-08 16:47 Wei Yang [this message]
2019-07-09 14:56 ` [PATCH] KVM: x86: Fix guest time accounting with VIRT_CPU_ACCOUNTING_GEN Sean Christopherson
[not found] ` <CANwVFYMwKqsvGhPS7ZpQRS-dJ58KMLRSx8oEk_PowMtwpfXK=A@mail.gmail.com>
2019-07-10 16:05 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190708164751.88385-1-w90p710@gmail.com \
--to=w90p710@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.