From: Paolo Bonzini <pbonzini@redhat.com>
To: Wanpeng Li <kernellwp@gmail.com>,
linux-kernel@vger.kernel.org, kvm@vger.kernel.org
Cc: "Radim Krčmář" <rkrcmar@redhat.com>,
"Wanpeng Li" <wanpeng.li@hotmail.com>
Subject: Re: [PATCH v2] KVM: LAPIC: Fix lapic timer injection delay
Date: Tue, 27 Jun 2017 18:10:10 +0200 [thread overview]
Message-ID: <c7b9aef2-f5e0-d613-a17c-ef1a262b344c@redhat.com> (raw)
In-Reply-To: <1498219190-6457-1-git-send-email-wanpeng.li@hotmail.com>
On 23/06/2017 13:59, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@hotmail.com>
>
> Linux as a guest will prevent to program the next event to the clock event
> device when the event is in the past. However, it is not guaranteed by all
> the guests, the guest like kvm-unit-tests/apic.flat will write current tsc
> value visible in guest to MSR_IA32_TSCDEADLINE, lapic timer which is emulated
> by vmx preemption timer will program the absolute target tsc value to vmcs
> preemption timer field w/ delta == 0, then plays a vmentry and an upcoming
> vmx preemption timer fire vmexit dance, the lapic timer injection is delayed
> for this duration. Actually the lapic timer which is emulated by hrtimer can
> handle this correctly.
>
> This patch fixes it by firing the lapic timer and injecting a timer interrupt
> immediately during the next vmentry if guest programs an expired timer to
> the emulated timer device. This saves ~300 cycles on the tsc_deadline_timer
> test of apic.flat.
If it doesn't matter for actual guests, I'd rather not complicate the logic.
Paolo
next prev parent reply other threads:[~2017-06-27 16:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 11:59 [PATCH v2] KVM: LAPIC: Fix lapic timer injection delay Wanpeng Li
2017-06-27 16:10 ` Paolo Bonzini [this message]
2017-06-27 22:09 ` Wanpeng Li
2017-06-27 22:10 ` Wanpeng Li
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=c7b9aef2-f5e0-d613-a17c-ef1a262b344c@redhat.com \
--to=pbonzini@redhat.com \
--cc=kernellwp@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rkrcmar@redhat.com \
--cc=wanpeng.li@hotmail.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 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).