Skip to content

Add y2038 safe replacements for read_boot_clock(), read_persistent_clock() and update_persistent_clock()

Xunlei Pang linux-omap linux-tegra lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8time: Add y2038 safe read_boot_clock64()include/linux/timekeeping.h kernel/time/timekeeping.c+10 -21 reply
2/8time: Add y2038 safe read_persistent_clock64()arch/mips/lasat/sysctl.c include/linux/timekeeping.h kernel/time/timekeeping.c+15 -120 replies
3/8time: Add y2038 safe update_persistent_clock64()drivers/rtc/systohc.c include/linux/timekeeping.h kernel/time/ntp.c+14 -20 replies
4/8ARM: OMAP: 32k counter: Provide y2038-safe omap_read_persistent_clock() replacementarch/arm/plat-omap/counter_32k.c+12 -101 reply
5/8ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock() replacementdrivers/clocksource/tegra20_timer.c+14 -71 reply
6/8ARM: time: Provide read_boot_clock64() and read_persistent_clock64()arch/arm/include/asm/mach/time.h arch/arm/kernel/time.c arch/arm/plat-omap/counter_32k.c +1 more+6 -231 reply
7/8s390: time: Provide read_boot_clock64() and read_persistent_clock64()arch/s390/include/asm/timex.h arch/s390/kernel/debug.c arch/s390/kernel/time.c+7 -70 replies
8/8time: Remove read_boot_clock()include/linux/timekeeping.h kernel/time/timekeeping.c+3 -120 replies

Reviews trailers per patch

3 of 8 patches have a Reviewed-by or Acked-by.

PatchThierry RedingTony Lindgren
1/8
2/8
3/8
4/8A-b
5/8A-b
6/8A-b
7/8
8/8

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

Read the v1 thread

Cover letter [PATCH 0/8] Add y2038 safe replacements for read_boot_clock(), read_persistent_clock() and update_persistent_clock()

From: Xunlei Pang <[email protected]>

read_boot_clock(), read_persistent_clock() and update_persistent_clock() all use timespec which may have "y2038 problem", thus we are planning on converting all of them to use timespec64.

The approach we're using is:
1) First of all, add the "__weak" implementaion of xxx_clock64() which uses xxx_clock() and timespec64.

Let's take read_persistent_clock() as an example. We can create its y2038-safe version below:

        void __weak read_persistent_clock64(struct timespec64 *ts64)
        {
             struct timespec ts;

            read_persistent_clock(&ts);
            *ts64 = timespec_to_timespec64(ts);
        }

Then, replace all the call sites of xxx_clock() with xxx_clock64() except the one used by xxx_clock64().

2) Convert every architecture specific xxx_clock() to xxx_clock64() one by one. At this point, we can convert the three functions at a time if needed, because most time they're correlated.

3) Remove xxx_clock() after all its architecture specific implementations have been converted to use corresponding y2038 safe xxx_clock64().

This patchset firstly finished the step1 for all the three functions, then focused on read_boot_clock() which is simple to go on with step2 and step3 as a whole show.

As for read_persistent_clock() and update_persistent_clock() which are more complex, requiring many efforts to convert every architecture specific implementation gradually.

The approach used here is Suggested-by: "Arnd Bergmann <[email protected]>"

Xunlei Pang (8):
time: Add y2038 safe read_boot_clock64()
time: Add y2038 safe read_persistent_clock64()
time: Add y2038 safe update_persistent_clock64()
ARM: OMAP: 32k counter: Provide y2038-safe
omap_read_persistent_clock() replacement
ARM: tegra: clock: Provide y2038-safe tegra_read_persistent_clock()
replacement
ARM: time: Provide read_boot_clock64() and read_persistent_clock64()
s390: time: Provide read_boot_clock64() and read_persistent_clock64()
time: Remove read_boot_clock()

 arch/arm/include/asm/mach/time.h    |  3 +--
 arch/arm/kernel/time.c              |  6 +++---
 arch/arm/plat-omap/counter_32k.c    | 18 ++++++------------
 arch/mips/lasat/sysctl.c            |  4 ++--
 arch/s390/include/asm/timex.h       |  4 ++--
 arch/s390/kernel/debug.c            |  4 ++--
 arch/s390/kernel/time.c             |  6 +++---
 drivers/clocksource/tegra20_timer.c | 15 +++++++--------
 drivers/rtc/systohc.c               |  2 +-
 include/linux/timekeeping.h         |  4 +++-
 kernel/time/ntp.c                   | 13 ++++++++++++-
 kernel/time/timekeeping.c           | 31 ++++++++++++++++---------------
 12 files changed, 58 insertions(+), 52 deletions(-)
Signature · 1 line
1.9.1