From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eduardo Habkost Subject: Re: [PATCH 2/3] target-i386: initialize vcpu's TSC rate to the value from KVM Date: Mon, 28 Sep 2015 13:17:44 -0300 Message-ID: <20150928161744.GE4130@thinpad.lan.raisama.net> References: <1443418711-24106-1-git-send-email-haozhong.zhang@intel.com> <1443418711-24106-3-git-send-email-haozhong.zhang@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, Paolo Bonzini , Marcelo Tosatti , Richard Henderson To: Haozhong Zhang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:39526 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933922AbbI1QRr (ORCPT ); Mon, 28 Sep 2015 12:17:47 -0400 Content-Disposition: inline In-Reply-To: <1443418711-24106-3-git-send-email-haozhong.zhang@intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Sep 28, 2015 at 01:38:30PM +0800, Haozhong Zhang wrote: > When creating a vcpu, we initialize its TSC rate to the value from > KVM (through ioctl KVM_GET_TSC_KHZ). > > Signed-off-by: Haozhong Zhang > --- > target-i386/kvm.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/target-i386/kvm.c b/target-i386/kvm.c > index 7b0ba17..c2b161a 100644 > --- a/target-i386/kvm.c > +++ b/target-i386/kvm.c > @@ -751,6 +751,13 @@ int kvm_arch_init_vcpu(CPUState *cs) > } > } > > + r = kvm_vcpu_ioctl(cs, KVM_GET_TSC_KHZ); > + if (r < 0) { > + fprintf(stderr, "KVM_GET_TSC_KHZ failed\n"); > + return r; > + } > + env->tsc_khz = r; You are silently overwriting the tsc_khz value set by the user, why? -- Eduardo