Re: [PATCH] KVM: LAPIC: Advancing the timer expiration on guest initiated write

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 03, 2021, Wanpeng Li wrote:
> > Side topic, I think there's a theoretical bug where KVM could inject a spurious
> > timer interrupt.  If KVM is using hrtimer, the hrtimer expires early due to an
> > overzealous timer_advance_ns, and the guest writes MSR_TSCDEADLINE after the
> > hrtimer expires but before the vCPU is kicked, then KVM will inject a spurious
> > timer IRQ since the premature expiration should have been canceled by the guest's
> > WRMSR.
> >
> > It could also cause KVM to soft hang the guest if the new lapic_timer.tscdeadline
> > is written before apic_timer_expired() captures it in expired_tscdeadline.  In
> > that case, KVM will wait for the new deadline, which could be far in the future.
> 
> The hrtimer_cancel() before setting new lapic_timer.tscdeadline in
> kvm_set_lapic_tscdeadline_msr() will wait for the hrtimer callback
> function to finish. Could it solve this issue?

Aha!  Yep, that prevents my theoretical bug.  Thanks!



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux