From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [RFC PATCH v4 2/2] add support for Hyper-V partition reference time enlightenment Date: Tue, 14 Jan 2014 12:03:24 +0100 Message-ID: <52D5197C.6090207@redhat.com> References: <1389691337-12050-1-git-send-email-vrozenfe@redhat.com> <1389691337-12050-3-git-send-email-vrozenfe@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, mtosatti@redhat.com, pl@dlhnet.de To: Vadim Rozenfeld Return-path: Received: from mail-qc0-f180.google.com ([209.85.216.180]:57550 "EHLO mail-qc0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbaANLDd (ORCPT ); Tue, 14 Jan 2014 06:03:33 -0500 Received: by mail-qc0-f180.google.com with SMTP id i17so2579797qcy.11 for ; Tue, 14 Jan 2014 03:03:32 -0800 (PST) In-Reply-To: <1389691337-12050-3-git-send-email-vrozenfe@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: The cleanup between v3 and v4 is really nice; thanks. What happened to the glitch you reported in the v3 thread. Il 14/01/2014 10:22, Vadim Rozenfeld ha scritto: > + tsc_ref.tsc_scale = ((10000LL << 32) / > + vcpu->arch.virtual_tsc_khz) << 32; As mentioned in the review of v3, I don't really like the tsc_scale to come from two different sources in the two cases of MSR write and KVM_SET_CLOCK. This is the only qualm I still have with this patch. Marcelo, do you have any ideas? Paolo > + tsc_ref.tsc_offset = kvm->arch.kvmclock_offset; > + } > if (__copy_to_user((void __user *)addr, &tsc_ref, sizeof(tsc_ref))) > return 1; > mark_page_dirty(kvm, gfn); > @@ -3871,6 +3879,27 @@ long kvm_arch_vm_ioctl(struct file *filp, > local_irq_enable(); > kvm->arch.kvmclock_offset = delta; > kvm_gen_update_masterclock(kvm); > + if (kvm->arch.hv_tsc_page & HV_X64_MSR_TSC_REFERENCE_ENABLE) { > + HV_REFERENCE_TSC_PAGE tsc_ref; > + struct kvm_arch *ka = &kvm->arch; > + r = kvm_read_guest(kvm, kvm->arch.hv_tsc_page, > + &tsc_ref, sizeof(tsc_ref)); > + if (r) > + goto out; > + if (tsc_ref.tsc_sequence > + && boot_cpu_has(X86_FEATURE_CONSTANT_TSC) > + && ka->use_master_clock) { > + tsc_ref.tsc_sequence++; > + tsc_ref.tsc_scale = ((10000LL << 32) / > + __get_cpu_var(cpu_tsc_khz)) << 32;