From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: RFC: VMX: initialize TSC offset relative to vm creation time Date: Sat, 13 Sep 2008 07:55:02 +0300 Message-ID: <48CB47A6.1050301@qumranet.com> References: <20080910205842.GA12514@dmt.cnet> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: kvm-devel , "David S. Ahern" , Chris Wright , Glauber de Oliveira Costa To: Marcelo Tosatti Return-path: Received: from il.qumranet.com ([212.179.150.194]:21892 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750851AbYIME53 (ORCPT ); Sat, 13 Sep 2008 00:57:29 -0400 In-Reply-To: <20080910205842.GA12514@dmt.cnet> Sender: kvm-owner@vger.kernel.org List-ID: 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. > > > This is good in principle, but we need to detect if we're on a multiple board host (or a host with unsynced tscs) and do something else in that case. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.