Skip to content

RFC clocksource / timekeeping rework V2

Martin Schwidefsky lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest12 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12introduce timekeeping_leap_insertinclude/linux/time.h kernel/time/ntp.c kernel/time/timekeeping.c+10 -51 reply
2/12remove clocksource inline functionsinclude/linux/clocksource.h kernel/time/timekeeping.c+18 -603 replies
3/12cleanup clocksource selectionarch/s390/kernel/time.c include/linux/clocksource.h kernel/time/clocksource.c +2 more+62 -1020 replies
4/12clocksource watchdog highres enablementkernel/time/clocksource.c+22 -250 replies
5/12clocksource watchdog resume logickernel/time/clocksource.c+15 -80 replies
6/12clocksource watchdog refactoringkernel/time/clocksource.c+68 -280 replies
7/12clocksource watchdog workinclude/linux/clocksource.h kernel/time/clocksource.c+40 -170 replies
8/12introduce struct timekeeperarch/s390/kernel/time.c include/linux/clocksource.h kernel/time/clocksource.c +1 more+152 -1320 replies
9/12add xtime_shift and ntp_error_shift to struct timekeeperkernel/time/timekeeping.c+18 -152 replies
10/12move NTP adjusted clock multiplier to struct timekeeperarch/arm/plat-omap/common.c include/linux/clocksource.h kernel/time/timekeeping.c+27 -229 replies
11/12timekeeper read clock helper functionskernel/time/timekeeping.c+38 -533 replies
12/12update clocksource with stop_machineinclude/linux/clocksource.h kernel/time/clocksource.c kernel/time/timekeeping.c+73 -860 replies

Reviews trailers per patch

1 of 12 patches has a Reviewed-by or Acked-by.

PatchJohn Stultz
1/12
2/12A-b
3/12
4/12
5/12
6/12
7/12
8/12
9/12
10/12
11/12
12/12

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

Read the v1 thread

Cover letter [RFC][patch 00/12] clocksource / timekeeping rework V2

Greetings,
version 2 of the clocksource / timekeeping cleanup patches. The series has grown quite a bit, what started with a simple idea to replace the tick based clocksource update with stop_machine is now a full fledged code rework.

The code is working on s390 and on my Athlon system at home which has a broken tsc clocksource:

[    0.000000] Fast TSC calibration using PIT
[    0.000341] hpet clockevent registered
[    0.000343] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.204021] hpet0: at MMIO 0xfefff000, IRQs 2, 8, 31
[    0.204027] hpet0: 3 comparators, 32-bit 25.000000 MHz counter
[    0.208007] Switching to clock hpet
[    0.211544] Switched to high resolution mode on CPU 0
[    0.211960] Switched to high resolution mode on CPU 1
[    8.000020] Clocksource tsc unstable (delta = -172310085 ns)

So the clocksource switch via stop_machine and the clocksource watchdog are working. I keep the fingers crossed that nothing else breaks.

The patch set is based on todays upstream tree plus the patches from the tip tree, if anyone wants to try them you need to pull from the master branch of

    git://git.kernel.org/pub/scm/linux/kernel/git/x86/linux-2.6-tip

There is still more room for improvement. Some sore points are:

1) The cycle_last value still is in the struct clocksource. It should be in the struct timekeeper but the check against cycles_last in the read function of the TSC clock source makes it hard.
2) read_persistent_clock returns seconds. With a really good initial time source this is not very precise. read_persistent_clock should return a struct timespec.
3) xtime, raw_time, total_sleep_time, timekeeping_suspended, jiffies, the ntp state and probably a few other values may be better located in the struct timekeeper as well.

and a few more I forgot.

Many thanks to John who pushed me into the right directions.

Signature · 4 lines
blue skies,
   Martin.

"Reality continues to ruin my life." - Calvin.