[lkml]   [2003]   [May]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: time interpolation hooks
>>>>> On Fri, 16 May 2003 14:23:11 -0700, Andrew Morton <> said:

Andrew> It will need per-arch support. I'm not sure what that looks
Andrew> like; maybe David can outline what the reset/update
Andrew> functions should do?

See below.

Andrew> (Those function pointers should go away in favour of
Andrew> optionally-stubbed-out static calls. Minor point).

Really? On ia64, we want to use cycle-based interpolation by default,
but if firmware indicates that the cycle-counters may drift, we want
to switch to one of several possible external counters (which counter
gets used depends on hardware/drivers are is present). Yes, we could
have a static call into ia64 specific code and then do an indirection
there, but if most platforms need an indirect call (I suspect they
do), it makes more sense to have the indirection directly in the core
code (especially if you believe Linus' mantra that indirect calls are
only going to get cheaper).

Anyhow, back to the reset/update functions:

For cycle-counter-based interpolation, the relevant file is this one:

Functions ia64_reset_wall_time() and ia64_update_wall_time() are what
the hooks would normally point to. Note that there is also an
important matching piece that updates last_nsec_offset in

(ia64_gettimeoffset() also reads last_nsec_offset, but only to handle
a rare error-case).

An example of the callback routines for an external high-precision
counter can be found here:

in functions sn2_update_wall_time() and sn2_reset_wall_time(). Note
that sn2_update_wall_time() needs to be updated to decrement
rtc_offset based on delta_nsec instead of rtc_per_timer_tick, but
since this isn't my code and since I added the delta_nsec offset only
recently, this hasn't been done yet.

The ia64 implementation does rely on having single-word cmpxchg. On
platforms that don't have this, it should be possible to emulate
cmpxchg with a spinlock, but you'd obviously end up serializing
concurrent gettimeofday() calls. And, in case it isn't obvious,
platforms that do not use time-interpolation don't have to do
anything, as the callbacks will default to doing nothing.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:35    [W:0.095 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site