All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 0/8] ntp/rtc: Fixes and cleanups
@ 2020-12-06 21:46 Thomas Gleixner
  2020-12-06 21:46 ` [patch 1/8] rtc: mc146818: Prevent reading garbage Thomas Gleixner
                   ` (8 more replies)
  0 siblings, 9 replies; 54+ messages in thread
From: Thomas Gleixner @ 2020-12-06 21:46 UTC (permalink / raw)
  To: LKML
  Cc: Alexandre Belloni, Jason Gunthorpe, Miroslav Lichvar,
	John Stultz, Prarit Bhargava, Alessandro Zummo, linux-rtc,
	Peter Zijlstra

Miroslav ran into a situation where the periodic RTC synchronization almost
never was able to hit the time window for the update. That happens due the
usage of delayed_work and the properties of the timer wheel.

While that particular problem is halfways simple to fix this started to
unearth other problems with that code particularly with rtc_set_npt_time()
but expanded into other things as well.

  1) The update offset for rtc-cmos is off by a full second

  2) The readout of MC146818 (rtc-cmos and arch code) is broken and can
     return garbage.

  2) Alexandre questioned the approach in general and wants to get rid of
     it. Of course there are better methods to do that and it can be
     completely done in user space.

     Unfortunately it's not that simple as this would be a user visible
     change, so making it at least halfways correct.

  3) Alexandre requested to move that code into the NTP code as this is not
     really RTC functionality and just usage of the RTC API.

  4) The update offset itself was questioned, but the time between the
     write and the next seconds increment in the RTC is fundamentaly a
     hardware property. The transport time, which is pretty irrelevant for
     direct accessible RTCs (rtc-cmos), but relevant for RTC behind i2c/SPI
     needs to be added on top.

     It's undebated that this transport time cannot be correctly estimated,
     but right now it's 500ms which is far off. The correct transport time
     can be calibrated, a halfways correct value supplied via DT, but
     that's an orthogonal problem.

The following series addresses the above:

    1) Fix the readout function of MC146818
    2) Fix the rtc-cmos offset
    3) Reduce the default transport time

    4) Switch the NTP periodic sync code to a hrtimer/work combo

    5) Move rtc_set_npt_time() to the ntp code
    6) Make the update offset more intuitive
    7) Simplify the whole machinery
     
Thanks,

	tglx
---
 a/drivers/rtc/systohc.c        |   61 ----------
 drivers/rtc/Makefile           |    1 
 drivers/rtc/class.c            |    9 +
 drivers/rtc/rtc-cmos.c         |    3 
 drivers/rtc/rtc-mc146818-lib.c |   70 +++++++-----
 include/linux/rtc.h            |   69 +++++-------
 include/linux/timex.h          |    1 
 kernel/time/ntp.c              |  232 ++++++++++++++++++++++++-----------------
 kernel/time/ntp_internal.h     |    7 +
 9 files changed, 225 insertions(+), 228 deletions(-)




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

end of thread, other threads:[~2021-02-11 23:10 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-06 21:46 [patch 0/8] ntp/rtc: Fixes and cleanups Thomas Gleixner
2020-12-06 21:46 ` [patch 1/8] rtc: mc146818: Prevent reading garbage Thomas Gleixner
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2021-01-25 18:40   ` [patch 1/8] rtc: mc146818: Prevent reading garbage - bug Mickaël Salaün
2021-01-26 13:26     ` Thomas Gleixner
2021-01-26 14:17       ` Mickaël Salaün
2021-01-26 15:35         ` Thomas Gleixner
2021-01-26 17:02           ` [PATCH V2] rtc: mc146818: Detect and handle broken RTCs Thomas Gleixner
2021-01-26 18:00             ` Alexandre Belloni
2021-01-27  8:41             ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2021-01-31 10:59             ` [PATCH V2] " Dirk Gouders
2021-02-01 13:53               ` Serge Belyshev
2021-02-01 19:09                 ` [PATCH] rtc: mc146818: Dont test for bit 0-5 in Register D Thomas Gleixner
2021-02-01 19:24                   ` [PATCH V2] " Thomas Gleixner
2021-02-01 19:32                     ` Linus Torvalds
2021-02-01 19:40                       ` Thomas Gleixner
2021-02-11 23:09                         ` Maciej W. Rozycki
2021-02-01 19:38                     ` Alexandre Belloni
2021-02-01 20:09                     ` Borislav Petkov
2021-02-01 20:15                     ` Dirk Gouders
2021-02-02  4:22                     ` Len Brown
2021-02-02 19:40                     ` [tip: timers/urgent] " tip-bot2 for Thomas Gleixner
2021-02-03 13:00                     ` [PATCH V2] " Mickaël Salaün
2020-12-06 21:46 ` [patch 2/8] rtc: mc146818: Reduce spinlock section in mc146818_set_time() Thomas Gleixner
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-06 21:46 ` [patch 3/8] rtc: cmos: Make rtc_cmos sync offset correct Thomas Gleixner
2020-12-07 20:50   ` Jason Gunthorpe
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-06 21:46 ` [patch 4/8] rtc: core: Make the sync offset default more realistic Thomas Gleixner
2020-12-07 20:55   ` Jason Gunthorpe
2020-12-10 23:59   ` Alexandre Belloni
2020-12-11  0:23     ` Thomas Gleixner
2020-12-11  0:28       ` Alexandre Belloni
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-06 21:46 ` [patch 5/8] ntp: Make the RTC synchronization more reliable Thomas Gleixner
2020-12-07 12:47   ` Miroslav Lichvar
2020-12-07 20:59   ` Jason Gunthorpe
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-29 19:41   ` [patch 5/8] " Geert Uytterhoeven
2021-01-11 10:12     ` Thomas Gleixner
2021-01-11 10:40       ` Geert Uytterhoeven
2020-12-06 21:46 ` [patch 6/8] ntp, rtc: Move rtc_set_ntp_time() to ntp code Thomas Gleixner
2020-12-07 20:59   ` Jason Gunthorpe
2020-12-09  3:51     ` Alexandre Belloni
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-06 21:46 ` [patch 7/8] ntp: Make the RTC sync offset less obscure Thomas Gleixner
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-06 21:46 ` [patch 8/8] ntp: Consolidate the RTC update implementation Thomas Gleixner
2020-12-07 21:05   ` Jason Gunthorpe
2020-12-11  9:23     ` Thomas Gleixner
2020-12-11 10:07   ` [tip: timers/core] " tip-bot2 for Thomas Gleixner
2020-12-09  0:33 ` [patch 0/8] ntp/rtc: Fixes and cleanups Thomas Gleixner
2020-12-09  4:01   ` Alexandre Belloni
2020-12-09 12:39     ` Thomas Gleixner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.