WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

RE: [Xen-devel] RE: rdtsc: correctness vs performance on Xen (and KVM?)

To: "Keir Fraser" <keir.fraser@xxxxxxxxxxxxx>, "Dan Magenheimer" <dan.magenheimer@xxxxxxxxxx>
Subject: RE: [Xen-devel] RE: rdtsc: correctness vs performance on Xen (and KVM?)
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Wed, 02 Sep 2009 08:16:30 +0100
Cc: Jeremy Fitzhardinge <jeremy@xxxxxxxx>, "Xen-Devel \(E-mail\)" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 02 Sep 2009 00:17:22 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <b5efa656-50f2-452d-89b3-2632afabadfc@default>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <C6C34FE4.13AC4%keir.fraser@xxxxxxxxxxxxx> <b5efa656-50f2-452d-89b3-2632afabadfc@default>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> Dan Magenheimer <dan.magenheimer@xxxxxxxxxx> 02.09.09 00:08 >>>
>> > 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
>> 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.
>
>The algorithm could check the pCPU number before and after
>reading the pvclock data and doing the rdtsc, and if they
>don't match, start again.  (Doesn't the pvclock algorithm
>already do that with some versioning number in the pvclock
>data itself to ensure that the rest of the data didn't
>change while it was being read?)

No, that won't do - the underlying pCPU may change multiple times
during that process.

>I'm clueless about GDTs and the LSL instrution so would
>need some help prototyping this.

As said in another reply, such a descriptor already exists
(PER_CPU_GDT_ENTRY).

But as also already said, I doubt you really need this.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel