alistair23-linux/kernel/time
Jason Gunthorpe 0f295b0650 rtc: Allow rtc drivers to specify the tv_nsec value for ntp
ntp is currently hardwired to try and call the rtc set when wall clock
tv_nsec is 0.5 seconds. This historical behaviour works well with certain
PC RTCs, but is not universal to all rtc hardware.

Change how this works by introducing the driver specific concept of
set_offset_nsec, the delay between current wall clock time and the target
time to set (with a 0 tv_nsecs).

For x86-style CMOS set_offset_nsec should be -0.5 s which causes the last
second to be written 0.5 s after it has started.

For compat with the old rtc_set_ntp_time, the value is defaulted to
+ 0.5 s, which causes the next second to be written 0.5s before it starts,
as things were before this patch.

Testing shows many non-x86 RTCs would like set_offset_nsec ~= 0,
so ultimately each RTC driver should set the set_offset_nsec according
to its needs, and non x86 architectures should stop using
update_persistent_clock64 in order to access this feature.
Future patches will revise the drivers as needed.

Since CMOS and RTC now have very different handling they are split
into two dedicated code paths, sharing the support code, and ifdefs
are replaced with IS_ENABLED.

Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Miroslav Lichvar <mlichvar@redhat.com>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
2017-10-30 15:03:24 -07:00
..
alarmtimer.c alarmtimer: Ensure RTC module is not unloaded 2017-08-31 21:36:45 +02:00
clockevents.c clockevents: Make clockevents_config() static 2017-03-23 12:14:05 -07:00
clocksource.c x86/tsc, sched/clock, clocksource: Use clocksource watchdog to provide stable sync points 2017-05-15 10:15:18 +02:00
hrtimer.c nanosleep: Use get_timespec64() and put_timespec64() 2017-06-30 04:14:14 -04:00
itimer.c itimer: Make timeval to nsec conversion range limited 2017-06-20 21:33:56 +02:00
jiffies.c jiffies: Revert bogus conversion of NSEC_PER_SEC to TICK_NSEC 2017-03-07 11:03:28 +01:00
Kconfig rcu: Remove nohz_full full-system-idle state machine 2017-06-08 18:52:39 -07:00
Makefile time: Remove CONFIG_TIMER_STATS 2017-02-10 11:15:08 +01:00
ntp.c rtc: Allow rtc drivers to specify the tv_nsec value for ntp 2017-10-30 15:03:24 -07:00
ntp_internal.h ntp: Fix second_overflow's input parameter type to be 64bits 2015-12-16 16:50:56 -08:00
posix-clock.c posix-timers: Move posix-timer internals to core 2017-06-04 15:40:23 +02:00
posix-cpu-timers.c posix-cpu-timers: Use dedicated helper to access rlimit values 2017-08-18 12:44:42 +02:00
posix-stubs.c posix-timers: Use get_timespec64() and put_timespec64() 2017-06-30 04:13:19 -04:00
posix-timers.c posix_clocks: Use get_itimerspec64() and put_itimerspec64() 2017-06-30 04:15:02 -04:00
posix-timers.h posix-timers: Make nanosleep timespec argument const 2017-06-14 00:00:47 +02:00
sched_clock.c timers, sched_clock: Update timeout for clock wrap 2017-03-23 12:30:27 -07:00
test_udelay.c time: Avoid timespec in udelay_test 2016-06-20 12:47:26 -07:00
tick-broadcast-hrtimer.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
tick-broadcast.c tick/broadcast: Make tick_broadcast_setup_oneshot() static 2017-06-12 18:56:01 +02:00
tick-common.c ktime: Cleanup ktime_set() usage 2016-12-25 17:21:22 +01:00
tick-internal.h tick/broadcast: Make tick_broadcast_setup_oneshot() static 2017-06-12 18:56:01 +02:00
tick-oneshot.c ktime: Get rid of the union 2016-12-25 17:21:22 +01:00
tick-sched.c Merge branch 'timers-nohz-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2017-07-03 13:33:57 -07:00
tick-sched.h nohz: Fix collision between tick and other hrtimers, again 2017-05-17 08:19:47 +02:00
time.c time: introduce {get,put}_itimerspec64 2017-06-25 21:58:46 -04:00
timeconst.bc time: Introduce jiffies64_to_nsecs() 2017-02-01 09:13:45 +01:00
timeconv.c time: Add time64_to_tm() 2016-06-20 12:47:15 -07:00
timecounter.c clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
timekeeping.c drivers/pps: aesthetic tweaks to PPS-related content 2017-09-08 18:26:51 -07:00
timekeeping.h timekeeping: Remove unused timekeeping_{get,set}_tai_offset() 2017-01-06 16:47:28 -08:00
timekeeping_debug.c PM / timekeeping: Print debug messages when requested 2017-07-23 00:03:43 +02:00
timekeeping_internal.h clocksource: Use a plain u64 instead of cycle_t 2016-12-25 11:04:12 +01:00
timer.c timers: Fix excessive granularity of new timers after a nohz idle 2017-08-24 11:40:18 +02:00
timer_list.c sysrq: Reset the watchdog timers while displaying high-resolution timers 2017-03-23 12:46:53 -07:00