High Resolution Timers on IA64

From: <eric.piel_at_tremplin-utc.net>
Date: 2003-12-19 03:44:02

Here is the first version of IA64 support for the High Resolution Timers Project. 

Let me sum up briefly the project for those not familiar with it: The aim of the
High Resolution Timers Project is to get rid of the current 1 jiffy resolution
of the kernel for the timers (and sleeps) to reach a resolution closer to the
one provided by the hardware. Grossly speaking, this feature is implemented by
scheduling additional clock ticks exactly at the time the next high resolution
timer is due to expire.
For instance, on our 1Ghz IA64 we measured timers with a resolution a bit
smaller than 10 microseconds (while for now it's around 1 millisecond).
Interestingly, on a x86 with the same frequency we obtained a resolution around
30 microseconds.

In order to try the patch you'll have to get a vanilla kernel 2.6.0-test5
and then apply in order those patches:
*official ia64 patch
*official HRT patch for 2.6.0-test5 (available at
sourceforge.net/projects/high-res-timers, it doesn't apply cleanly, don't worry)
*2.6.0-t5-hrt_syscalls.diff (it's available in the latest kernels, just correct
some typos)
*hrtimers-2.6.0-test5-compil-20031213.patch (an update for the official HRT patch)
*hrtimers-ia64-2.6.0-test5-20031218.patch (the real thing)
In the config you'll have to enable HRT and select ITC as the source clock.
After the reboot you should get a HRT actived kernel :-)

To use the feature from the kernel (in a driver for instance) you just create
timers normally and modify a new field "sub_jiffies". This field contains a
value between 0 and arch_cycles_per_jiffy - 1.
On the userland side you access the high resolution timers through the new POSIX
RT syscalls clock_*() and timer_*(), using the clock_id CLOCK_REALTIME_HR. As
there isn't yet support for those syscalls in the glibc you have to link with a
small special library. Get and apply hrtimers-support-2.5.62-1.0.patch (from
sourceforge.net/projects/high-res-timers, don't worry about the old version
number) and then apply hrtimers-support-ia64-2.6.0-t5-20031212.patch .
Then you compile your code with -lposixtime .

Note about this release:
Please consider this code as alpha. It shouldn't do bad things on your machine
but there is a known bug that causes some timers to still have a resolution
around one jiffy, especially on CPUs other than the time-keeper. Any comment,
reports of success or failure would be very welcome!

Thanks to Nick Pollitt for the original work on 2.4 and Alexandre Hessemann for
the current support.
Eric Piel

PS: All the attached patches can also be found at http://pieleric.free.fr/hrt/ .

To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Received on Thu Dec 18 11:49:54 2003

This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:21 EST