Commit f1ff89ec authored by Roman Kagan's avatar Roman Kagan Committed by Radim Krčmář

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: default avatarRoman Kagan <rkagan@virtuozzo.com>
Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
parent f244deed
...@@ -649,9 +649,10 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu) ...@@ -649,9 +649,10 @@ void kvm_hv_process_stimers(struct kvm_vcpu *vcpu)
} }
if ((stimer->config & HV_STIMER_ENABLE) && if ((stimer->config & HV_STIMER_ENABLE) &&
stimer->count) stimer->count) {
if (!stimer->msg_pending)
stimer_start(stimer); stimer_start(stimer);
else } else
stimer_cleanup(stimer); stimer_cleanup(stimer);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment