[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c7b9aef2-f5e0-d613-a17c-ef1a262b344c@redhat.com>
Date: Tue, 27 Jun 2017 18:10:10 +0200
From: Paolo Bonzini <pbonzini@...hat.com>
To: Wanpeng Li <kernellwp@...il.com>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org
Cc: Radim Krčmář <rkrcmar@...hat.com>,
Wanpeng Li <wanpeng.li@...mail.com>
Subject: Re: [PATCH v2] KVM: LAPIC: Fix lapic timer injection delay
On 23/06/2017 13:59, Wanpeng Li wrote:
> From: Wanpeng Li <wanpeng.li@...mail.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
Powered by blists - more mailing lists