Re: [PATCHv3 13/16] pps: capture MONOTONIC_RAW timestamps as well

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: john stultz
Date: Wednesday, August 4, 2010 - 4:03 pm

On Thu, 2010-08-05 at 01:06 +0400, Alexander Gordeev wrote:

Hmm. So this brings up an interesting point. If the system is an one
which uses arch_gettimeoffset() (which means it doesn't have
clocksources), I'm not sure if this function would return what you'd
expect.

The issue is that jiffies is the basic clocksource that is in use on
these systems, but the arch_gettimeoffset() function returns an
inter-tick time value (usually by reading the interrupt generating
decrementer or whatnot). So in this case, you'd get a
CLOCK_MONOTONIC_RAW time that is based off the raw jiffies value at the
last tick, and CLOCK_REALTIME time value at the exact time of the call.

That offset between the two would then vary depending on when in the
inter-tick period the call was made.


The two solutions would be:
1) Add the arch_gettimeoffset() value to nsecs_raw as well. Should be
safe, as any freq variance from the raw freq will be limited to 1 tick
length and won't accumulate.

2) Don't add arch_gettimeoffset to either value, providing the raw and
real time values at the last tick.

I'd probably go with #1.

Otherwise, the code looks good.

thanks
-john


--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCHv3 00/16] pps: several fixes and improvements, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 01/16] pps: trivial fixes, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 03/16] pps: fix race in PPS_FETCH handler, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 04/16] pps: unify timestamp gathering, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 06/16] pps: convert printk/pr_* to dev_*, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 07/16] pps: move idr stuff to pps.c, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 08/16] pps: add async PPS event handler, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 10/16] pps: use BUG_ON for kernel API safety checks, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 11/16] pps: simplify conditions a bit, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 13/16] pps: capture MONOTONIC_RAW timestamps as well, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 14/16] pps: add kernel consumer support, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 15/16] pps: add parallel port PPS client, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
[PATCHv3 16/16] pps: add parallel port PPS signal generator, Alexander Gordeev, (Wed Aug 4, 2:06 pm)
Re: [PATCHv3 13/16] pps: capture MONOTONIC_RAW timestamps ..., john stultz, (Wed Aug 4, 4:03 pm)
Re: [PATCHv3 15/16] pps: add parallel port PPS client, Andrew Morton, (Wed Aug 4, 4:34 pm)
Re: [PATCHv3 03/16] pps: fix race in PPS_FETCH handler, Vitezslav Samel, (Wed Aug 4, 10:19 pm)
Re: [PATCHv3 01/16] pps: trivial fixes, Rodolfo Giometti, (Thu Aug 5, 1:57 am)
Re: [PATCHv3 03/16] pps: fix race in PPS_FETCH handler, Rodolfo Giometti, (Thu Aug 5, 2:15 am)
Re: [PATCHv3 04/16] pps: unify timestamp gathering, Rodolfo Giometti, (Thu Aug 5, 2:17 am)
Re: [PATCHv3 03/16] pps: fix race in PPS_FETCH handler, Alexander Gordeev, (Thu Aug 5, 3:19 am)
Re: [PATCHv3 03/16] pps: fix race in PPS_FETCH handler, Vitezslav Samel, (Thu Aug 5, 4:07 am)
Re: [PATCHv3 13/16] pps: capture MONOTONIC_RAW timestamps ..., Alexander Gordeev, (Thu Aug 5, 5:16 am)
Re: [PATCHv3 13/16] pps: capture MONOTONIC_RAW timestamps ..., Alexander Gordeev, (Thu Aug 5, 5:29 am)
Re: [PATCHv3 15/16] pps: add parallel port PPS client, Alexander Gordeev, (Thu Aug 5, 5:48 am)
Re: [PATCHv3 03/16] pps: fix race in PPS_FETCH handler, Alexander Gordeev, (Thu Aug 5, 7:31 am)