Re: itimer oddness in 2.6.12

Tom Marshall
2005-07-22T20:58:28Z

[-- Attachment #1: Type: text/plain, Size: 1863 bytes --]

On Fri, Jul 22, 2005 at 08:21:25PM +0100, Paulo Marques wrote:
> Tom Marshall wrote:
> >The patch to fix "setitimer timer expires too early" is causing issues for
> >the Helix server. We have a timer processs that updates the server's
> >timestamp on an itimer and it expects the signal to be delivered at roughly
> >the interval retrieved from getitimer. This is very consistent on every
> >platform, including Linux up to 2.6.11, but breaks on 2.6.12. On 2.6.12,
> >setting the itimer to 10ms and retrieving the actual interval from
> >getitimer
> >reports 10.998ms, but the timer interrupts are consistently delivered at
> >roughly 11.998ms.
>
> Unfortunately, this is not so clear cut as it seems :(

Yes, I am sure that it is not a simple problem. I am not a kernel developer
but I imagine that issues such as NTP adjustments would complicate this
issue. I must also admit that I am not intimately familiar with the POSIX
spec regarding itimers.

Our current code does a setitimer followed by getitimer, then uses the
actual interval retrieved by getitimer to set a global timer delta. On each
timer signal, it updates the notion of the current time by the timer delta.
As mentioned, this works on every other platform (Solaris, BSD, HPUX, AIX,
DGUX, IRIX, Tru64, and Linux up to 2.6.11) but breaks on 2.6.12.

This is not an insurmountable problem for userspace. It can be easily
solved by using gettimeofday in the timer interrupt instead of adding the
delta to the current time blindly. No big deal. I just wanted to point
this issue out and ensure that (1) it was a known issue, and (2) it is the
direction that the Linux kernel intends to take. If so, no big deal and we
can modify the timer code to take that into account.

--
Apathy Club meeting this Friday. If you want to come, you're not invited.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]