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

From: John Stultz
Date: Thu Jun 11 2015 - 18:55:15 EST


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 <prarit@xxxxxxxxxx>
Cc: Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>
Cc: Richard Cochran <richardcochran@xxxxxxxxx>
Cc: Jan Kara <jack@xxxxxxx>
Cc: Jiri Bohac <jbohac@xxxxxxx>
Cc: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Shuah Khan <shuahkh@xxxxxxxxxxxxxxx>


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(-)

--
1.9.1

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