From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Lieven Subject: Re: [RFC PATCH v2 1/2] add support for Hyper-V reference time counter Date: Thu, 23 May 2013 15:20:31 +0200 Message-ID: <519E179F.6000307@dlhnet.de> References: <1368947197-9033-1-git-send-email-vrozenfe@redhat.com> <1368947197-9033-2-git-send-email-vrozenfe@redhat.com> <20130522004614.GA7322@amt.cnet> <745195650.5763962.1369207977883.JavaMail.root@redhat.com> <519D3ED6.8010804@redhat.com> <519DB495.8040708@dlhnet.de> <1203166753.6432195.1369311921642.JavaMail.root@redhat.com> <519E172A.9040706@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: Vadim Rozenfeld , Marcelo Tosatti , kvm@vger.kernel.org, gleb@redhat.com, pl@dlh.net To: Paolo Bonzini Return-path: Received: from ssl.dlhnet.de ([91.198.192.8]:55610 "EHLO ssl.dlh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758245Ab3EWNUc (ORCPT ); Thu, 23 May 2013 09:20:32 -0400 In-Reply-To: <519E172A.9040706@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 23.05.2013 15:18, Paolo Bonzini wrote: > Il 23/05/2013 14:25, Vadim Rozenfeld ha scritto: >> >> >> ----- Original Message ----- >> From: "Peter Lieven" >> To: "Paolo Bonzini" >> Cc: "Vadim Rozenfeld" , "Marcelo Tosatti" , kvm@vger.kernel.org, gleb@redhat.com, pl@dlh.net >> Sent: Thursday, May 23, 2013 4:17:57 PM >> Subject: Re: [RFC PATCH v2 1/2] add support for Hyper-V reference time counter >> >> On 22.05.2013 23:55, Paolo Bonzini wrote: >>> Il 22/05/2013 09:32, Vadim Rozenfeld ha scritto: >>>>>> @@ -1827,6 +1829,29 @@ static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) >>>>>> if (__copy_to_user((void __user *)addr, instructions, 4)) >>>>>> return 1; >>>>>> kvm->arch.hv_hypercall = data; >>>>>> + local_irq_disable(); >>>>>> + kvm->arch.hv_ref_count = get_kernel_ns(); >>>>>> + local_irq_enable(); >>>>>> + break; >>>> local_irq_disable/local_irq_enable not needed. >>>> >>>> >>>> What is the reasoning behind reading this time value at msr write time? >>>> [VR] Windows writs this MSR only once, during HAL initialization. >>>> So, I decided to treat this call as a partition crate event. >>>> >>> >>> But is it expected by Windows that the reference count starts counting >>> up from 0 at partition creation time? If you could just use >>> (get_kernel_ns() + kvm->arch.kvmclock_offset) / 100, it would also be >>> simpler for migration purposes. >> >> I can just report, that I have used the patch that does it that way and it works. >> Maybe Windows is calculating the uptime by the reference counter? >> >> [VR] >> Windows use it (reference counters/iTSC/PMTimer/HPET) as a time-stamp source >> for (Ke)QueryPerformanceCounter function. > > So I would prefer to remove kvm->arch.hv_ref_count altogether. But only if the migration support is guaranteed. And what if we have a host which lacks invariant TSC support? Peter > > Paolo >