All of lore.kernel.org
 help / color / mirror / Atom feed
* Questions on the PIT and APIC timer in Xen
@ 2012-03-28  7:31 Bei Guan
  2012-03-28 13:00 ` Jan Beulich
  2012-03-28 15:46 ` Dan Magenheimer
  0 siblings, 2 replies; 8+ messages in thread
From: Bei Guan @ 2012-03-28  7:31 UTC (permalink / raw)
  To: Xen Devel; +Cc: Andrei E. Warkentin


[-- Attachment #1.1: Type: text/plain, Size: 254 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 362 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-28  7:31 Questions on the PIT and APIC timer in Xen Bei Guan
@ 2012-03-28 13:00 ` Jan Beulich
  2012-03-28 13:50   ` Bei Guan
  2012-03-28 15:46 ` Dan Magenheimer
  1 sibling, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2012-03-28 13:00 UTC (permalink / raw)
  To: Bei Guan; +Cc: xen-devel, Andrei E. Warkentin

>>> On 28.03.12 at 09:31, Bei Guan <gbtju85@gmail.com> wrote:
> I wonder whether the PIT/APIC timer for HVM Guest OS is emulated by Xen or
> not.

Of course they are.

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

A PV guest can't make use of either.

Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-28 13:00 ` Jan Beulich
@ 2012-03-28 13:50   ` Bei Guan
  2012-03-28 13:58     ` Jan Beulich
  0 siblings, 1 reply; 8+ messages in thread
From: Bei Guan @ 2012-03-28 13:50 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Andrei E. Warkentin


[-- Attachment #1.1: Type: text/plain, Size: 661 bytes --]

2012/3/28 Jan Beulich <JBeulich@suse.com>

> >>> On 28.03.12 at 09:31, Bei Guan <gbtju85@gmail.com> wrote:
> > I wonder whether the PIT/APIC timer for HVM Guest OS is emulated by Xen
> or
> > not.
>
> Of course they are.
>
> > What's difference between setting the boot PIT/APIC timer for a PV Guest
> OS
> > and HVM Guest OS?
>
> A PV guest can't make use of either.
>
Hi Jan,

Thank you for your reply.
But, I also would like to know what timer a PV Guest OS on Xen use? And how
does Xen set the timer for a PV Guest.
The same questions for a HVM Guest OS, how does Xen set the timer for a
HVM? Thank you very much.


>
> Jan
>
>


-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 1333 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-28 13:50   ` Bei Guan
@ 2012-03-28 13:58     ` Jan Beulich
  2012-03-28 14:31       ` Bei Guan
  0 siblings, 1 reply; 8+ messages in thread
From: Jan Beulich @ 2012-03-28 13:58 UTC (permalink / raw)
  To: Bei Guan; +Cc: xen-devel, Andrei E. Warkentin

>>> On 28.03.12 at 15:50, Bei Guan <gbtju85@gmail.com> wrote:
> But, I also would like to know what timer a PV Guest OS on Xen use?

There's a specific PV timer interface.

> And how does Xen set the timer for a PV Guest.

"Set" the timer?

> The same questions for a HVM Guest OS, how does Xen set the timer for a
> HVM?

Same here.

But I think you're best off looking at the code anyway.

Jan

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-28 13:58     ` Jan Beulich
@ 2012-03-28 14:31       ` Bei Guan
  0 siblings, 0 replies; 8+ messages in thread
From: Bei Guan @ 2012-03-28 14:31 UTC (permalink / raw)
  To: Jan Beulich; +Cc: xen-devel, Andrei E. Warkentin


[-- Attachment #1.1: Type: text/plain, Size: 626 bytes --]

2012/3/28 Jan Beulich <JBeulich@suse.com>

> >>> On 28.03.12 at 15:50, Bei Guan <gbtju85@gmail.com> wrote:
> > But, I also would like to know what timer a PV Guest OS on Xen use?
>
> There's a specific PV timer interface.
>
> > And how does Xen set the timer for a PV Guest.
>
> "Set" the timer?
>
I mean how PV Guest OS get its timer from Xen.
But, maybe I will find out the details from the code. Thank you very much.



>
> > The same questions for a HVM Guest OS, how does Xen set the timer for a
> > HVM?
>
> Same here.
>
> But I think you're best off looking at the code anyway.
>
> Jan
>
>


-- 
Best Regards,
Bei Guan

[-- Attachment #1.2: Type: text/html, Size: 1331 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-28  7:31 Questions on the PIT and APIC timer in Xen Bei Guan
  2012-03-28 13:00 ` Jan Beulich
@ 2012-03-28 15:46 ` Dan Magenheimer
  2012-03-29  1:45   ` Bei Guan
  1 sibling, 1 reply; 8+ messages in thread
From: Dan Magenheimer @ 2012-03-28 15:46 UTC (permalink / raw)
  To: Bei Guan, Xen Devel; +Cc: Andrei E. Warkentin


[-- Attachment #1.1: Type: text/plain, Size: 1977 bytes --]

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.

 

Hope that helps,

Dan

 

From: Bei Guan [mailto:gbtju85@gmail.com] 
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

 

[-- Attachment #1.2: Type: text/html, Size: 5739 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-28 15:46 ` Dan Magenheimer
@ 2012-03-29  1:45   ` Bei Guan
  2012-03-29 15:08     ` Dan Magenheimer
  0 siblings, 1 reply; 8+ messages in thread
From: Bei Guan @ 2012-03-29  1:45 UTC (permalink / raw)
  To: Dan Magenheimer; +Cc: Xen Devel, Andrei E. Warkentin


[-- Attachment #1.1: Type: text/plain, Size: 2818 bytes --]

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

> 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@gmail.com]
> *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

[-- Attachment #1.2: Type: text/html, Size: 5808 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: Questions on the PIT and APIC timer in Xen
  2012-03-29  1:45   ` Bei Guan
@ 2012-03-29 15:08     ` Dan Magenheimer
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Magenheimer @ 2012-03-29 15:08 UTC (permalink / raw)
  To: Bei Guan; +Cc: Xen Devel, Andrei E. Warkentin


[-- Attachment #1.1: Type: text/plain, Size: 3625 bytes --]

(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@gmail.com] 
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 <HYPERLINK "mailto:dan.magenheimer@oracle.com"dan.magenheimer@oracle.com>

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:HYPERLINK "mailto:gbtju85@gmail.com" \ngbtju85@gmail.com] 
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

 

[-- Attachment #1.2: Type: text/html, Size: 11582 bytes --]

[-- Attachment #2: Type: text/plain, Size: 126 bytes --]

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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2012-03-29 15:08 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-28  7:31 Questions on the PIT and APIC timer in Xen Bei Guan
2012-03-28 13:00 ` Jan Beulich
2012-03-28 13:50   ` Bei Guan
2012-03-28 13:58     ` Jan Beulich
2012-03-28 14:31       ` Bei Guan
2012-03-28 15:46 ` Dan Magenheimer
2012-03-29  1:45   ` Bei Guan
2012-03-29 15:08     ` Dan Magenheimer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.