All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* clocksources: order of preference
@ 2008-05-08 10:40 Philipp Kohlbecher
  2008-05-08 10:59 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Kohlbecher @ 2008-05-08 10:40 UTC (permalink / raw
  To: linux-kernel; +Cc: Thomas Gleixner, John Stultz

Why is the TSC preferred to the HPET as a clocksource for the x86 
architecture?

"Understanding the Linux Kernel" states that the HPET is preferable to 
the TSC due to its richer architecture. Up to version 2.6.17.14, 
arch/i386/kernel/timers/timer.c also contained a comment to that effect 
and accordingly ranked the HPET before the TSC.

This was changed when the new clocksource infrastructure was introduced 
with version 2.6.18. (The HPET clocksource received a rating of 250; the 
TSC, 300.)

Preferring the TSC leads to problems when it is unstable. While this can 
be prevented by setting CONFIG_X86_TSC, certain distribution kernels 
(striving for compatibility) don't, resulting in soft lockups.

Are there better reasons to prefer the TSC or may I submit a patch that 
swaps the respective ratings?

Thanks for reading,
- Philipp Kohlbecher

Please CC me, I am not on the list.

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

* Re: clocksources: order of preference
  2008-05-08 10:40 clocksources: order of preference Philipp Kohlbecher
@ 2008-05-08 10:59 ` Thomas Gleixner
  2008-05-08 11:07   ` Philipp Kohlbecher
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2008-05-08 10:59 UTC (permalink / raw
  To: Philipp Kohlbecher; +Cc: linux-kernel, John Stultz

On Thu, 8 May 2008, Philipp Kohlbecher wrote:
> Why is the TSC preferred to the HPET as a clocksource for the x86
> architecture?

Performance. TSC access is extremly fast as it is a per CPU
register. HPET is a chipset device and scales bad when multiple CPUs
try to access it simultanously as the access is serialized in
hardware. Even on a UP system the access overhead is somewhere in the
range of factor 100.

> "Understanding the Linux Kernel" states that the HPET is preferable to the TSC
> due to its richer architecture. Up to version 2.6.17.14,
> arch/i386/kernel/timers/timer.c also contained a comment to that effect and
> accordingly ranked the HPET before the TSC.
> 
> This was changed when the new clocksource infrastructure was introduced with
> version 2.6.18. (The HPET clocksource received a rating of 250; the TSC, 300.)

We always tried to use TSC as the first choice.
 
> Preferring the TSC leads to problems when it is unstable. While this can be
> prevented by setting CONFIG_X86_TSC, certain distribution kernels (striving
> for compatibility) don't, resulting in soft lockups.

No, we only use the TSC, when:

- the TSC is known to be stable (not affected by CPU frequency changes)
- the TSC is sychronized accross CPUs

We also check the TSC with a watchdog mechanism, which verifies that
is is keeping accurate time. When we detect that TSC does not, we
replace it by the next available clock source.

> Are there better reasons to prefer the TSC or may I submit a patch that swaps
> the respective ratings?

You may submit one, but it's very unlikely that is gets applied. :)

Thanks,
	tglx

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

* Re: clocksources: order of preference
  2008-05-08 10:59 ` Thomas Gleixner
@ 2008-05-08 11:07   ` Philipp Kohlbecher
  2008-05-08 11:46     ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Philipp Kohlbecher @ 2008-05-08 11:07 UTC (permalink / raw
  To: Thomas Gleixner; +Cc: linux-kernel, John Stultz

Thomas Gleixner wrote:
> We also check the TSC with a watchdog mechanism, which verifies that
> is is keeping accurate time. When we detect that TSC does not, we
> replace it by the next available clock source.
>   
True. In all the cases I know, the watchdog mechanism worked and marked 
the TSC as unstable. The soft lockup only led to a (sometimes 
considerable) delay at boot time.
> You may submit one, but it's very unlikely that is gets applied. :)
>   
Makes sense. :)

Thank you for your extremely quick reply!
- Philipp Kohlbecher

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

* Re: clocksources: order of preference
  2008-05-08 11:07   ` Philipp Kohlbecher
@ 2008-05-08 11:46     ` Thomas Gleixner
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Gleixner @ 2008-05-08 11:46 UTC (permalink / raw
  To: Philipp Kohlbecher; +Cc: linux-kernel, John Stultz

On Thu, 8 May 2008, Philipp Kohlbecher wrote:
> Thomas Gleixner wrote:
> > We also check the TSC with a watchdog mechanism, which verifies that
> > is is keeping accurate time. When we detect that TSC does not, we
> > replace it by the next available clock source.
> >   
> True. In all the cases I know, the watchdog mechanism worked and marked the
> TSC as unstable. The soft lockup only led to a (sometimes considerable) delay
> at boot time.

Yeah, there are some hard to detect cases. This TSC business is a
major PITA.

Thanks,
	tglx

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

end of thread, other threads:[~2008-05-08 11:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-08 10:40 clocksources: order of preference Philipp Kohlbecher
2008-05-08 10:59 ` Thomas Gleixner
2008-05-08 11:07   ` Philipp Kohlbecher
2008-05-08 11:46     ` Thomas Gleixner

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.