From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38146) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZTr-00025f-QA for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:02:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aMZTo-00079b-J9 for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:02:15 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:35458) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aMZTo-00079V-Bz for qemu-devel@nongnu.org; Fri, 22 Jan 2016 06:02:12 -0500 Received: by mail-wm0-x244.google.com with SMTP id 123so16543249wmz.2 for ; Fri, 22 Jan 2016 03:02:12 -0800 (PST) Sender: Paolo Bonzini References: <1450949580-25759-1-git-send-email-asmetanin@virtuozzo.com> <56A1FF8F.3050701@redhat.com> <56A20131.8090102@virtuozzo.com> From: Paolo Bonzini Message-ID: <56A20C30.4020608@redhat.com> Date: Fri, 22 Jan 2016 12:02:08 +0100 MIME-Version: 1.0 In-Reply-To: <56A20131.8090102@virtuozzo.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v1] kvm/x86: Hyper-V tsc page setup List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: asmetanin@virtuozzo.com, kvm@vger.kernel.org Cc: Gleb Natapov , "Denis V. Lunev" , Roman Kagan , qemu-devel@nongnu.org On 22/01/2016 11:15, Andrey Smetanin wrote: >> >> - unless KVM can use a master clock, it is incorrect to set up the TSC >> page this way; the sequence needs to be 0xFFFFFFFF in that case > 0xFFFFFFFF is not an invalid value for tsc page, > see https://lkml.org/lkml/2015/11/2/655 oh, I see now. >> - writing the TSC page must be done while all VCPUs are stopped, because >> the TSC page doesn't provide the possibility for the guest to retry in >> the middle of an update (like seqcount in Linux doess) > I think Windows guest gives tsc page address at boot time and protects > against other vcpu's tsc page access. Sometimes the TSC is detected to be unstable and Linux switches to another clocksource. At least in that case you can get a write to the TSC page while the guest is running. In that case it would be enough to write a zero to tsc_sequence, which _can_ be done atomically while the guest is running. However, KVM already has a mechanism to stop all VCPUs (KVM_REQ_MASTERCLOCK_UPDATE) so we might as well use it. Paolo