>>>>> On Fri, 16 May 2003 14:23:11 -0700, Andrew Morton <firstname.lastname@example.org> 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?
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 email@example.com
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Fri May 23 2003 - 22:00:26 EST