public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* time / gtod seconds value out of sync?
@ 2015-02-19 18:35 Nishanth Aravamudan
  2015-02-19 19:03 ` John Stultz
  0 siblings, 1 reply; 5+ messages in thread
From: Nishanth Aravamudan @ 2015-02-19 18:35 UTC (permalink / raw)
  To: john.stultz; +Cc: tglx, linux-kernel, jstancek

Hi John,

We're seeing an interesting issue with the openposix testcase
difftime/1-1, which basically calls gtod/time, sleeps, calls time/gtod,
then difftime and sees if they disagree. The issue occurs with either
vDSO implementations or direct syscalls.

We are seeing failures on ppc64le and x86_64 (probably other places too,
just not tested yet), because (I'm pretty sure), the time() syscalls
granularity is not accounting for the nsecs value at all. Instead, it
just returns get_seconds().

In one case, I see, in sys_time():

[  313.001823] NACC: timekeeping_get_ns = 1000121642
[  314.001889] NACC: timekeeping_get_ns = 188401

gtod correctly accumulates those nsecs into the secs value:

                ts->tv_sec = tk->xtime_sec;
                nsecs = timekeeping_get_ns(&tk->tkr);
                ts->tv_nsec = 0;
                timespec64_add_ns(ts, nsecs);

but time() does:

		return tk->xtime_sec;

It seems like overkill to do the full timekeeping_get_ns() in time(),
but maybe it's also necessary to account for leap seconds? That is, we
need to ensure that accumulate_nsecs_to_secs() has been called before
return tk->xtime_sec?

Thoughts?

Thanks,
Nish


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-02-20 13:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-19 18:35 time / gtod seconds value out of sync? Nishanth Aravamudan
2015-02-19 19:03 ` John Stultz
2015-02-19 19:16   ` Ingo Molnar
2015-02-19 19:28   ` Nishanth Aravamudan
2015-02-20 13:31     ` Jan Stancek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox