From: "Jan Beulich" Subject: Re: RE: rdtsc: correctness vs performance on Xen (and KVM?) Date: Wed, 02 Sep 2009 08:01:33 +0100 Message-ID: <4A9E346D0200007800012E69@vpn.id2.novell.com> References: <4A9D62460200007800012BA1@vpn.id2.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline 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 , Dan Magenheimer Cc: Jeremy Fitzhardinge , "Xen-Devel (E-mail)" , Alan Cox List-Id: xen-devel@lists.xenproject.org >>> Keir Fraser 01.09.09 23:25 >>> >On 01/09/2009 17:04, "Jan Beulich" wrote: > >>>>> Dan Magenheimer 01.09.09 17:56 >>> >>> Can you think of any trick (that doesn't require the cost of a >>> trap/hypercall) to allow an app to determine what pcpu >>> it is running on? >>=20 >> Just like what is being used to allow apps to get the CPU number on = native >> kernels (or the vCPU one on Xen-ified ones): Have a GDT entry the limit = of >> which is the number you want, and have the app use the lsl instruction = to >> get at it. > >Yes, that's true. Xen could provide such a segment descriptor in its = private >area of the GDT. The issue then would be that, in a compound pvclock And in fact there already is such a descriptor, just with DPL=3D0. >operation spanning multiple machine instructions, the pCPU number = revealed >by the LSL instruction can be stale by the time it is used later in the >compound operation. Correct. Jan