Re: [patch 00/21] hrtimer - High-resolution timer subsystem

From: George Anzinger
Date: Wed Dec 21 2005 - 23:30:52 EST


Roman Zippel wrote:
Hi,

On Mon, 19 Dec 2005, George Anzinger wrote:


You don't think the current behaviour is wrong.



One of the issues I see with using your assumption is that moving the timer to
an absolute clock after the initial expiry _may_ lead to additional
qauntization errors, depending on how aligned the two clocks are.


What do you mean by "moving the timer to an an absolute clock"?

The assumption I am making is that the timer is connected to a clock (CLOCK_MONOTONIC or CLOCK_REALTIME). Timers on CLOCK_REALTIME with the absolute flag set should expire at the requested time as read from that clock, where as relative timers are not affected by time setting and thus should be on CLOCK_MONOTONIC. It is unclear, in general, how these two clocks relate to each other at the nanosecond level, or so one might think. Of course, we can define this problem away by a particular definition of one of these clocks as being derived from the other (which we, infact, do in Linux).


I would guess, then, that either the non-absolute or the absolute timer
behaves badly in the face of clock setting. Could you provide a pointer to
the NetBSD code so I can have a look too?


http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/kern/kern_time.c?rev=1.98&content-type=text/x-cvsweb-markup
AFAICT TIMER_ABSTIME is only used to convert the relative value to an absolute value.

Yes, there is also this interesting comment in settime:
/* WHAT DO WE DO ABOUT PENDING REAL-TIME TIMEOUTS??? */

I strongly suspect that this system does NOT expire absolute timers and clock_nanosleep calls at the requested time in the face of clock setting.

I see NO hooks in the referenced code that would allow them to find such timers at clock set time, nor are they entered into any different list to make them findable. It would appear that the absolute attribute is lost as soon as the time is convereted to a relative time.

In fairness, the POSIX folks added the clock setting requirement a few years after the absolute flag was defined... but, still, there is that comment.


--
George Anzinger george@xxxxxxxxxx
HRT (High-res-timers): http://sourceforge.net/projects/high-res-timers/
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/