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] write_tsc in a PV domain?

To: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
Subject: Re: [Xen-devel] write_tsc in a PV domain?
From: Jeremy Fitzhardinge <jeremy@xxxxxxxx>
Date: Fri, 28 Aug 2009 10:02:05 -0700
Cc: "Xen-Devel \(E-mail\)" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Alan Cox <alan@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 28 Aug 2009 10:02:26 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <d3c83762-a28b-4dcc-b368-e955e8fa1e7a@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: <d3c83762-a28b-4dcc-b368-e955e8fa1e7a@default>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.1) Gecko/20090814 Fedora/3.0-2.6.b3.fc11 Lightning/1.0pre Thunderbird/3.0b3
On 08/27/09 20:29, Dan Magenheimer wrote:
>> If an app is sophisticated to do this correctly then it 
>> doesn't need any
>> special assistance from a hypervisor to make the tsc well-behaved.  It
>> should continue to work even in a Xen guest where both the process can
>> skip between VCPUs and the VCPUs can skip between PCPUs.
>>     
> No, I don't think this is true.  An enterprise app that binds processes
> to fixed physical processors on a physical machine can make
> assumptions about the results of rdtsc that aren't valid when
> the vcpus can skip between pcpus. 

You can bind a vcpu to a pcpu or group of pcpus with the right tsc
properties.  At this point you're talking about a specialized
non-portable app with very sensitive dependencies on the system software
and underlying hardware, so requiring some special effort to virtualize
it doesn't seem like a big problem.

>  Further, like Linux itself,
> applications may test assumptions about tsc at startup that are
> assumed to remain valid for the life of the app, which is
> perfectly reasonable on a physical machine and a bad mistake
> in a virtualized environment.
>   

Not really.  An app can't tell whether its initial test happened to be
in a stable period that will be later upset by a power event,
suspend/resume, migration via some other mechanism (like
vserver/containers), etc, etc.  An app making such assumptions will be
very machine and system dependent, and not at all portable.

> True, but any app that tries to run on a NUMA machine without
> being aware of the idiosyncracies of a NUMA machine probably
> has worse problems to deal with than tsc sync.  Further, there
> are many many apps that will likely never ever run on those
> machines.

Who can say?  Effects caused by locality issues will only result in
performance problems rather than outright correctness problems.

>   Are we going to penalize all apps all the time
> because some might run some of the time on a machine where
> tsc is not synced?
>   
They're already penalized.  The population of machines with a tsc which
can be used in the manner you're suggesting is very small, and even then
there are strong caveats.

>> But in this case I'm talking specifically about a Xen PV guest, where
>> the tsc is claimed for use by the Xen clocksource ABI.
>>     
> I just don't understand how you can say that a valid userland
> instruction is "claimed for use" by Xen (or Linux or both).
>   

Apps are free to try and use the tsc in any way they feel like, but it
has never had any guaranteed properties.  Some uses are completely
reasonable (like using it as some entropy to seed an RNG, for example). 
At one point the kernel did disable the tsc for usermode use, but that
was quickly reverted (or perhaps it never made it to mainline) because
its not for the kernel to break backwards compatibility for the sake of
second-guessing usermode.

I think this is getting a bit repetitive.

    J

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