Skip to content

Fixes for leapsecond expiring early ABS_TIME CLOCK_REALTIME timers

John Stultz lkml 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest5 patches 12 repliesIn review
  2. v1 RFC4 patches 35 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5time: Move clock_was_set_seq update to before we update the shadow-timekeeperkernel/time/timekeeping.c+8 -40 replies
2/5ntp: Introduce and use SECS_PER_DAY macro instead of 86400kernel/time/ntp.c+3 -20 replies
3/5time: Do leapsecond adjustment to avoid early timer expirationsinclude/linux/time64.h include/linux/timekeeper_internal.h kernel/time/ntp.c +2 more+61 -80 replies
4/5ntp: Do leapsecond adjustment in adjtimex read pathkernel/time/ntp.c+18 -01 reply
5/5selftests: timers: Add leap-second timer edge testing to leap-a-day.ctools/testing/selftests/timers/leap-a-day.c+72 -40 replies

Reviews trailers per patch

None of the 5 patches has a Reviewed-by or Acked-by.

PatchRichard Cochran
1/5
2/5
3/5Originally-suggested-by
4/5
5/5

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH 0/5 v2] Fixes for leapsecond expiring early ABS_TIME CLOCK_REALTIME timers

So this is a second round at trying to address the issue, trying to integrate feedback from Ingo and Thomas, trying to simplify what I can. I've also split out the changes so each can be more easily reviewed. Its still not tiny, but its simpler.

This series is against tip/timers/core, and the first patch isn't strictly related but is a fix that is needed in tip/timers/core.

As Prarit reported here:
https://lkml.org/lkml/2015/5/27/458

Since the leapsecond is applied at timer tick time, and not the actual second edge, ABS_TIME CLOCK_REALTIME timers set for right after the leapsecond could fire a second early, since some timers may be expired before we trigger the timekeeping timer, which then applies the leapsecond.

Thus this patch series tries to address this issue, including extending the leap-a-day test to catch this problem, as well as other relevant fixups I found while working on the code.

This series has only had limited testing, so I wanted to send it out for initial review and comment. Folks can grab this tree via git for testing here:
https://git.linaro.org/people/john.stultz/linux.git dev/early-leap-timer

Thoughts and feedback would be appreciated!
thanks
-john

Cc Prarit Bhargava <[email protected]>
Cc Daniel Bristot de Oliveira <[email protected]>
Cc Richard Cochran <[email protected]>
Cc Jan Kara <[email protected]>
Cc Jiri Bohac <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Shuah Khan <[email protected]>

John Stultz (5):
time: Move clock_was_set_seq update to before we update the
shadow-timekeeper
ntp: Introduce and use SECS_PER_DAY macro instead of 86400
time: Do leapsecond adjustment to avoid early timer expirations
ntp: Do leapsecond adjustment in adjtimex read path
selftests: timers: Add leap-second timer edge testing to leap-a-day.c

 include/linux/time64.h                      |  1 +
 include/linux/timekeeper_internal.h         |  2 +
 kernel/time/ntp.c                           | 61 ++++++++++++++++++++---
 kernel/time/ntp_internal.h                  |  1 +
 kernel/time/timekeeping.c                   | 35 +++++++++++--
 tools/testing/selftests/timers/leap-a-day.c | 76 +++++++++++++++++++++++++++--
 6 files changed, 160 insertions(+), 16 deletions(-)
Signature · 1 line
1.9.1