|
From: | Andrey Smetanin |
Subject: | Re: [Qemu-devel] [PATCH v1] kvm/x86: Remove Hyper-V SynIC timer stopping |
Date: | Mon, 14 Dec 2015 20:01:23 +0300 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.0.1 |
On 12/14/2015 07:09 PM, Paolo Bonzini wrote:
On 14/12/2015 16:33, Andrey Smetanin wrote:It's possible that guest send us Hyper-V EOM at the middle of Hyper-V SynIC timer running, so we start processing of Hyper-V SynIC timers in vcpu context and stop the Hyper-V SynIC timer uncoditionally and lose time expiration which Windows 2012R2 guest expects. The patch fixes such situation by not stopping Hyper-V SynIC timer at all, because it's safe to restart it without stop in vcpu context and timer callback always returns HRTIMER_NORESTART.Can you summarize with a "picture" what is the bad race?
host guest start periodic stimer start periodic timer timer expires after 15ms send expiration message into guest restart periodic timer ....doing something.... timer expires again after 15 ms msg slot is still not cleared so setup ->msg_pending restart periodic timer ....doing something.... process timer msg and clear slot so ->msg_pending was set: send EOM into host received EOM queued call of kvm_hv_process_stimers() by KVM_REQ_HV_STIMER kvm_hv_process_stimers(): ... stimer_stop() if (time_now >= stimer->exp_time) stimer_expiration(stimer); But time_now < stimer->exp_time, so stimer_expiration is not called in this case and timer is not restarted. so guest lose timer.
The patch seems safe, but I'd like to have a better understanding of what goes wrong. Paolo
[Prev in Thread] | Current Thread | [Next in Thread] |