[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [Xen-devel] RE: Saving/Restoring IA32_TSC_AUX MSR



Dan Magenheimer wrote:
>> As I know, RDTSCP can used to implment fast vgetcpu in
>> newer Linux kernel.
> 
> Yes, but code which uses fast vgetcpu is expecting
> to get physical cpu and physical node number.  Since
> an HVM guest OS only has access to virtual cpu and
> virtual node number, the information written to TSC_AUX
> by a guest OS is misleading and may silently break any
> userland code that assumes it is getting physical
> information.

This is depend on how the node info is virtualized. 
If the virtual node could reflect the physical
node info, what rdtscp returns is valuable to applications. 

> 
> I continue to think this is a bad idea and, to use Keir's
> words, is "Supporting CPU instructions just because
> they're there".
> 
> But, if I am overruled, I'd like to see some measurement
> of the cycle cost for writing to TSC_AUX.  Since
> Linux only writes it once at __cpuinit time, I wouldn't
> be surprised to find out that it is horribly slow
> and adding it to every context switch would be slowing
> down all users of Xen for a handful of applications --
> that are getting incorrect information (vcpu vs pcpu)
> anyway.

According to the current PVRDTSC logic, write_rdtscp_aux()
is called in each scheduling ( schedule()->
update_vcpu_system_time()->__update_vcpu_system_time()->
write_rdtscp_aux() ), which is more frequent than
__context_switch(). 

> 
>> -----Original Message-----
>> From: Keir Fraser [mailto:keir.fraser@xxxxxxxxxxxxx]
>> Sent: Friday, December 11, 2009 2:22 AM
>> To: Zhang, Xiantao; Dan Magenheimer; Xu, Dongxiao; Nakajima, Jun;
>> xen-devel@xxxxxxxxxxxxxxxxxxx Cc: Dugger, Donald D
>> Subject: Re: [Xen-devel] RE: Saving/Restoring IA32_TSC_AUX MSR
>> 
>> 
>> On 11/12/2009 08:43, "Zhang, Xiantao" <xiantao.zhang@xxxxxxxxx>
>> wrote: 
>> 
>>>> The question has to be: what win do we get for faithful
>>>> virtualisation of RDTSCP in a virtualised environment? Supporting
>>>> CPU instructions just because they're there is not a useful effort.
>>> 
>>> As I know, RDTSCP can used to implment fast vgetcpu in newer Linux
>>> kernel. Current node and cpu info is saved in the MSR, and
>>> applications or libraries can get this info at ring3 through this
>>> instruction. If enable this instruction for vmx non-root mode,  it
>>> should benefit these kernels I think. 
>> 
>> Sounds reasonable. Obviously this will be incompatible with
>> pvrdtscp, but
>> the latter is off by default so this isn't a too serious
>> problem I think.
>> Pvrdtscp will simply trump ordinary RDTSCP emulation when it
>> is enabled.
>> 
>> You can put your meddling with TSC_AUX MSR in the context-switch
>> path, regradless of whether pvrdtscp's stays in
>> __update_vcpu_system_time(). 
>> 
>> In short: have at it.
>> 
>>  -- Keir
>> 
>> 
>> 
>> _______________________________________________
>> Xen-devel mailing list
>> Xen-devel@xxxxxxxxxxxxxxxxxxx
>> http://lists.xensource.com/xen-devel



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.