Messages in this thread Patch in this message | | | Subject | Possible clocksource wrapping issues w/ new vdso clock_gettime() code? | From | john stultz <> | Date | Mon, 23 Jul 2007 10:59:43 -0700 |
| |
Hey Andi, I've not been able to review the new vdso code very carefully yet, but I noticed one thing right off: the offset calculation is not masked, so its possible w/ counters less then 64bits wide to have wrapping issues.
It seems something like the following would be needed.
diff --git a/arch/x86_64/vdso/vclock_gettime.c b/arch/x86_64/vdso/vclock_gettime.c index 17f6a00..9570f8e 100644 --- a/arch/x86_64/vdso/vclock_gettime.c +++ b/arch/x86_64/vdso/vclock_gettime.c @@ -36,8 +36,8 @@ static inline long vgetns(void) { cycles_t (*vread)(void); vread = gtod->clock.vread; - return ((vread() - gtod->clock.cycle_last) * gtod->clock.mult) >> - gtod->clock.shift; + return (((vread() - gtod->clock.cycle_last) & gtod->clock.mask) * + gtod->clock.mult) >> gtod->clock.shift; } static noinline int do_realtime(struct timespec *ts)
Or am I just missing something?
thanks -john
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |