diff options
author | Roman Kagan <rkagan@virtuozzo.com> | 2017-07-20 16:26:40 +0200 |
---|---|---|
committer | Radim Krčmář <rkrcmar@redhat.com> | 2017-07-20 17:00:00 +0200 |
commit | f1ff89ec4447c4e39d275a1ca3de43eed2a92745 (patch) | |
tree | 63d4bf5301a833733d77cc55a560f76015320047 | |
parent | KVM: VMX: Fix invalid guest state detection after task-switch emulation (diff) | |
download | linux-f1ff89ec4447c4e39d275a1ca3de43eed2a92745.tar.xz linux-f1ff89ec4447c4e39d275a1ca3de43eed2a92745.zip |
kvm: x86: hyperv: avoid livelock in oneshot SynIC timers
If the SynIC timer message delivery fails due to SINT message slot being
busy, there's no point to attempt starting the timer again until we're
notified of the slot being released by the guest (via EOM or EOI).
Even worse, when a oneshot timer fails to deliver its message, its
re-arming with an expiration time in the past leads to immediate retry
of the delivery, and so on, without ever letting the guest vcpu to run
and release the slot, which results in a livelock.
To avoid that, only start the timer when there's no timer message
pending delivery. When there is, meaning the slot is busy, the
processing will be restarted upon notification from the guest that the
slot is released.
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
Signed-off-by: Radim Krčmář <rkrcmar@redhat.com>
-rw-r--r-- | arch/x86/kvm/hyperv.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 2695a34fa1c5..337b6d2730fa 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -649,9 +649,10 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu) } if ((stimer->config & HV_STIMER_ENABLE) && - stimer->count) - stimer_start(stimer); - else + stimer->count) { + if (!stimer->msg_pending) + stimer_start(stimer); + } else stimer_cleanup(stimer); } } |