• Radim Krčmář's avatar
    KVM: x86: fix deadline tsc interrupt injection · 1e0ad70c
    Radim Krčmář authored
    The check in kvm_set_lapic_tscdeadline_msr() was trying to prevent a
    situation where we lose a pending deadline timer in a MSR write.
    Losing it is fine, because it effectively occurs before the timer fired,
    so we should be able to cancel or postpone it.
    
    Another problem comes from interaction with QEMU, or other userspace
    that can set deadline MSR without a good reason, when timer is already
    pending:  one guest's deadline request results in more than one
    interrupt because one is injected immediately on MSR write from
    userspace and one through hrtimer later.
    
    The solution is to remove the injection when replacing a pending timer
    and to improve the usual QEMU path, we inject without a hrtimer when the
    deadline has already passed.
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    Reported-by: default avatarNadav Amit <namit@cs.technion.ac.il>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    1e0ad70c
lapic.c 48 KB