From: Dan Magenheimer Subject: RE: [PATCH] replace rdtsc emulation-vs-native xen boot option with per-domain (hypervisor part) Date: Thu, 8 Oct 2009 16:35:27 -0700 (PDT) Message-ID: <6723d7e3-245e-4723-9482-758b9066718d@default> References: Mime-Version: 1.0 Content-Type: text/plain; charset=Windows-1252 Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "Xen-Devel (E-mail)" List-Id: xen-devel@lists.xenproject.org > From: Keir Fraser [mailto:keir.fraser@eu.citrix.com] >=20 > On 06/10/2009 14:49, "Dan Magenheimer"=20 > wrote: >=20 > > This was intended to record the offset across migration. > > But a per-domain stime offset must already be recorded > > somewhere else, or hvm fully-emulated platform timers > > would be broken across migration. > >=20 > > Do pv guests need something similar or is it magically > > handled someplace that I couldn't quickly find? >=20 > PV guests understand that there will be a system-time=20 > discontinuity across > save/restore. All I did was remove an unused field. You can=20 > reintro it when > you use it. Interestingly, I find that there is a discontinuity for HVM guests as well (with either tsc_native=3D0 or tsc_native=3D1). This can be demonstrated easily by running a rdtsc loop in a user program that fails if time goes backwards or jumps forward too far, then doing a save/restore. I had assumed that the VT-x tsc_offset mechanism would handle the discontinuity but apparently it was never implemented. (I didn't test live migration, so maybe the mechanism IS used if time goes backwards, but I suspect not.) Since TSC is used for inter-jiffie interpolation on many Linux systems (and the system I ran the test on reports "Using 3.5xxx MHz WALL PM GTOD PIT/TSC timer"), I'm surprised a huge discontinuity doesn't cause at least some interesting problem for some HVM OS's. Oops, it does. I see a soft lockup reported when I save/restore an HVM domain (tested with tsc_native=3D1, e.g. no tsc emulation). Looks like another one for the "fix the tsc" list... Dan