Re: [RFC][PATCH 4/4] time: Clean up CLOCK_MONOTONIC_RAW time handling

From: John Stultz
Date: Fri Aug 25 2017 - 17:17:03 EST


On Fri, Aug 25, 2017 at 11:55 AM, John Stultz <john.stultz@xxxxxxxxxx> wrote:
> I'll look over the code again to see if I can catch anything by
> review. Worse case if we can't get any traction on this in a day or so
> I'll submit a revert.

I think I found the issue. In tk_update_ktime_data() I add the raw_sec
and shifted down tk->tkr_raw.xtime_nsec to the base. But we already
add the tk->tkr_raw.xtime_nsec to the offset and shift it all down in
the timekeeping_delta_to_ns called from ktime_get_raw, so we
effectively are accumulating the nsecs portion faster then we should.

This only crops up for internal ktime_get_raw() users, but not
getrawmonotonic64() which uses the timespec generation rather then the
ktime method, which is why this wasn't seen by userspace time tests.

I'll send a patch for testing shortly.

thanks
-john