qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Andrey Smetanin <asmetanin@virtuozzo.com>
To: Paolo Bonzini <pbonzini@redhat.com>, kvm@vger.kernel.org
Cc: Gleb Natapov <gleb@kernel.org>, "Denis V. Lunev" <den@openvz.org>,
	Roman Kagan <rkagan@virtuozzo.com>,
	qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH v1] kvm/x86: Remove Hyper-V SynIC timer stopping
Date: Mon, 14 Dec 2015 19:48:40 +0300	[thread overview]
Message-ID: <566EF2E8.60301@virtuozzo.com> (raw)
In-Reply-To: <566EE9B4.4040104@redhat.com>



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?
>
Currently I see that guest starts periodic timer and doesn't clear 
message slot after timer expires, so timer expires again and trying to 
deliver expiration message but message slot is still busy so we set 
->msg_pending flag for guest to receive EOM. timer restarts again and 
while it's not expired guest notifies us with EOM, in this case we 
schedule timer processing in vcpu context by KVM_REQ_HV_STIMER, 
kvm_hv_process_stimers() is called in vcpu context and stops the timer
before it expires, so timer is disabled forever but guest expects it's
periodic expiration(15ms).

I do not understand why Windows doesn't clear message slot for a long 
time, it's likely need to be analyzed with debugger(and need more 
research). But we can go out from such situation by such fix.

> The patch seems safe, but I'd like to have a better understanding of
> what goes wrong.
>
> Paolo
>

  reply	other threads:[~2015-12-14 16:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-14 15:33 [Qemu-devel] [PATCH v1] kvm/x86: Remove Hyper-V SynIC timer stopping Andrey Smetanin
2015-12-14 16:09 ` Paolo Bonzini
2015-12-14 16:48   ` Andrey Smetanin [this message]
2015-12-14 17:01   ` Andrey Smetanin
2015-12-16 17:54     ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=566EF2E8.60301@virtuozzo.com \
    --to=asmetanin@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkagan@virtuozzo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).