FreeBSD timing issues and qemu (was: Re: [Qemu-devel] Re: Breakage with local APIC routing)

Garrett Wollman wollman at hergotha.csail.mit.edu
Tue Sep 8 05:43:16 UTC 2009


In article <bc2d970909071917n12256d9ucee24327aec3d527 at mail.gmail.com>,
Ryan Stone  <rysto32 at gmail.com> wrote:
>I'm not entirely clear on why it's done this way, but the timer is run at
>twice hz for statistics-gathering purposes*.  CPU usage statistics gathering
>is driven off of the timer interrupt.  Running the timer at twice hz may be
>an attempt to eliminate clock-aliasing problems; if so, it's a poor way of
>doing so.

The statistics timer is supposed to be jittered with an exponential
distribution, so that applications cannot avoid being charged for CPU
time by running synchronously (and out-of-phase) with the timer.  This
was historically broken on PC hardware, and is probably still broken
on SMP PC hardware, because there are insufficient programmable timer
interrupts.  Ideally, you'd like a distinct statistics timers on each
CPU, with a sufficiently (quickly) programmable period.

-GAWollman



More information about the freebsd-current mailing list