Re: 2.6.23-rc3-mm1 - vdso and gettimeofday issues with glibc

From: Andi Kleen
Date: Sat Sep 08 2007 - 04:58:11 EST



> In the vdso code:
>
> 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;
> }
>
>
> Looks like an open-coded version of this in the kernel timekeeping code:

vdso code needs to be all inlined because the vdso runs in ring 3 and cannot
access other kernel code.

It was opencoded it to have more control over the code (vdso requirements
are a bit peculiar).

> But the vdso version isn't doing any masking. And the mask is different for
> different clocksources, so it has to track the underlying kernel's clocksource
> when it gets changed.

vdso effectively only supports TSC and HPET (the other clock sources are not accessible
from ring 3)

TSC doesn't need a mask, but many HPETs need a 32bit mask; good point.

Does adding the mask to vgetns make the clock problems go away?

-Andi

-
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/