strange system clock issues

Ben Scott dragonhawk at gmail.com
Thu Aug 27 09:13:46 EDT 2009


On Thu, Aug 27, 2009 at 8:18 AM, Thomas Charron<twaffle at gmail.com> wrote:
>  Anything that can be a clock, including the RTC, can be used as the
> clock source for the kernel.

  According to /Understanding the Linux Kernel/, the source you cite,
the RTC is never used as a clock source for the kernel.  I quote:

  "Linux uses the RTC only to derive the time and date; however, it
allows processes to program the RTC by acting on the /dev/rtc device
file."

  (/Understanding the Linux Kernel/, Third Edition.  Bovet, et. al.
O'Reilly, 2005.  Chapter 6, Section 1.2.)

> timer_hpet, timer_pmtmr, timer_tsc,
> timer_pit, timer_none are the five most commonly used timer sources
> for the kernel.

  This I didn't know, although I had begun to realize something was
different when I looked at my interrupt stats on my home PC last
night.  :)  Thanks for the information; those keywords were good
Google fodder.

  According to /Understanding the Linux Kernel/ (ibid):

timer_pit = Programmable Interrupt Timer, the classic system timer on
IRQ0, which the BIOS programs to fire at 18 Hz, and the kernel
normally programs to fire at 1000 Hz.

timer_tsc = Time Stamp Counter, which on Pentium and newer chips
counts CPU clock cycles in a CPU register.  At boot, the kernel uses
the PIT to measure the TSC rate.

timer_hpet = High Precision Event Timer, which is a newer chip that's
kind of like a better PIT.  Apparently the kernel can use the APIC to
have this come in on IRQ0 instead of the traditional PIT.  (ibid, Sect
6.2.2.1.)  I presume an HPET would only be present if an APIC is
available.

timer_pmtmr = ACPI Power Management Timer, which is fixed at 3.58 MHz.
 The kernel will use this if the CPU will vary clock frequency (thus
making TSC non-useful for timekeeping) but the HPET is not available.

timer_none = Not a clock source.  This is used as a placeholder during
early kernel initialization, before the kernel has picked a clock
source.

-- Ben



More information about the gnhlug-discuss mailing list