From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Smetanin Subject: Re: [PATCH v1] kvm/x86: Remove Hyper-V SynIC timer stopping Date: Mon, 14 Dec 2015 19:48:40 +0300 Message-ID: <566EF2E8.60301@virtuozzo.com> References: <1450107185-31490-1-git-send-email-asmetanin@virtuozzo.com> <566EE9B4.4040104@redhat.com> Reply-To: Mime-Version: 1.0 Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , Roman Kagan , "Denis V. Lunev" , To: Paolo Bonzini , Return-path: Received: from mx2.parallels.com ([199.115.105.18]:50958 "EHLO mx2.parallels.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbbLNQtO (ORCPT ); Mon, 14 Dec 2015 11:49:14 -0500 In-Reply-To: <566EE9B4.4040104@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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 >