From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: RFC: VMX: initialize TSC offset relative to vm creation time Date: Thu, 11 Sep 2008 05:32:18 -0300 Message-ID: <20080911083218.GB18128@dmt.cnet> References: <20080910205842.GA12514@dmt.cnet> <20080910221843.GF17969@poweredge.glommer> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm-devel , "David S. Ahern" , Chris Wright , Glauber de Oliveira Costa To: Glauber Costa Return-path: Received: from mx1.redhat.com ([66.187.233.31]:50483 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752871AbYIKIdP (ORCPT ); Thu, 11 Sep 2008 04:33:15 -0400 Content-Disposition: inline In-Reply-To: <20080910221843.GF17969@poweredge.glommer> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Sep 10, 2008 at 07:18:43PM -0300, Glauber Costa wrote: > On Wed, Sep 10, 2008 at 05:58:42PM -0300, Marcelo Tosatti wrote: > > > > VMX initializes the TSC offset for each vcpu at different times, and > > also reinitializes it for vcpus other than 0 on APIC SIPI message. > > > > This bug causes the TSC's to appear unsynchronized in the guest, even if > > the host is good. > > > > Older Linux kernels don't handle the situation very well, so > > gettimeofday is likely to go backwards in time: > > > > http://www.mail-archive.com/kvm@vger.kernel.org/msg02955.html > > http://sourceforge.net/tracker/index.php?func=detail&aid=2025534&group_id=180599&atid=893831 > > > > Fix it by initializating the offset of each vcpu relative to vm creation > > time, and moving it from vmx_vcpu_reset to vmx_vcpu_setup, out of the > > APIC MP init path. > > How does it work if # vcpu > # pcpus? I remember that when I tried it, the big biting dog were > cases in which all cpus tried to sync, but they naturally put the value "0" in different points of time > (for obvious reasons), and would still appear unsynchronized to the guests. Seems to work fine. All vcpus now put the value "0" relative to VM creation.