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

Re: [Xen-devel] Questions on the PIT and APIC timer in Xen



(sorry all for the top post... it’s hard to reply to HTML properly in my mailer)


Hi Ben –

 

On recent Linux kernels, setting “clocksource=tsc tsc=reliable” as guest kernel parameters should be faster than pvclock because pvclock reads the tsc to drive its algorithm.


CMOS timer is very very slow.  If you are not familiar with virtual time issues, you should read the VMware paper.  Xen virtual time management is a little different (because VMware can do binary translation) but most of the concepts are the same and this paper also is a very good explanation of all the different clock/timer hardware:

 

http://www.vmware.com/files/pdf/Timekeeping-In-VirtualMachines.pdf

 

From: Bei Guan [mailto:gbtju85@xxxxxxxxx]
Sent: Wednesday, March 28, 2012 7:45 PM
To: Dan Magenheimer
Cc: Xen Devel; Andrei E. Warkentin
Subject: Re: [Xen-devel] Questions on the PIT and APIC timer in Xen

 

 

2012/3/28 Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>

Both the PIT and APIC (as well as HPET) timers are emulated by Xen for an HVM guest.  However there have always been rare hard-to-reproduce problems when guests use them.  At one time, there were workarounds that required a special parameter “timer_mode” to be selected for HVM guests.  If I recall correctly, different timer modes overcame different limitations of different timer emulations (or maybe mismatches between guest “bugs” exposed by virtual time and true hypervisor emulation).  These timer_mode workarounds may or may not work with more recent Linux and Windows guests.  And there are still periodic bug fixes being applied for timers in the hypervisor emulation code.

 

At 4.0, full TSC emulation was added in an attempt to provide a high-resolution guaranteed monotonic timer.   However, most legacy HVM guests cannot or refuse to use TSC as a timer.  (And there may be lurking bugs there as well.)


For most PV guest OS’s, the pvclock algorithm is used so PIT/APIC/HPET emulation should be unnecessary (and, if used, is likely buggy).  And actually pvclock should be superceded by using TSC, which is always faster, but for most workloads the performance difference doesn’t matter.

 

If you are interested in a good (but difficult) Xen project, “virtual time” still needs work and documentation.  I would be happy to provide lots of background documentation but can’t volunteer to help much more than that right now.

Hi Dan,

 

Thank you for your detailed reply and your kindness.

So, you mean the pvclock algorithm is very faster than any Xen emulated timer, while a TSC timer is very faster than the pvclock for some workloads, right?

Is it possible that Xen initial its timer from the hardware now, such as CMOS timer? Why PV guest OS doesn't use this timer instead of using the timer from the pv clock algorithm? If there is any problem with my question, please correct me. 

 

Thank you very much. 

Bei

 

 

 

 

Hope that helps,

Dan

 

From: Bei Guan [mailto:gbtju85@xxxxxxxxx]
Sent: Wednesday, March 28, 2012 1:32 AM
To: Xen Devel
Cc: Andrei E. Warkentin
Subject: [Xen-devel] Questions on the PIT and APIC timer in Xen

 

Hi,

 

I wonder whether the PIT/APIC timer for HVM Guest OS is emulated by Xen or not.

What's difference between setting the boot PIT/APIC timer for a PV Guest OS and HVM Guest OS?  

 

I would appreciate any reply for my question.

 

--
Best Regards,

Bei Guan

 



 

--
Best Regards,

Bei Guan

 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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