diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2018-04-25 09:33:38 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2018-04-26 08:53:32 -0400 |
commit | a3ed0e4393d6885b4af7ce84b437dc696490a530 (patch) | |
tree | 1bdf479028163df953d98db29ae4ebbba73a2fd7 /include/linux/timekeeping.h | |
parent | 1f71addd34f4c442bec7d7c749acc1beb58126f2 (diff) |
Revert: Unify CLOCK_MONOTONIC and CLOCK_BOOTTIME
Revert commits
92af4dcb4e1c ("tracing: Unify the "boot" and "mono" tracing clocks")
127bfa5f4342 ("hrtimer: Unify MONOTONIC and BOOTTIME clock behavior")
7250a4047aa6 ("posix-timers: Unify MONOTONIC and BOOTTIME clock behavior")
d6c7270e913d ("timekeeping: Remove boot time specific code")
f2d6fdbfd238 ("Input: Evdev - unify MONOTONIC and BOOTTIME clock behavior")
d6ed449afdb3 ("timekeeping: Make the MONOTONIC clock behave like the BOOTTIME clock")
72199320d49d ("timekeeping: Add the new CLOCK_MONOTONIC_ACTIVE clock")
As stated in the pull request for the unification of CLOCK_MONOTONIC and
CLOCK_BOOTTIME, it was clear that we might have to revert the change.
As reported by several folks systemd and other applications rely on the
documented behaviour of CLOCK_MONOTONIC on Linux and break with the above
changes. After resume daemons time out and other timeout related issues are
observed. Rafael compiled this list:
* systemd kills daemons on resume, after >WatchdogSec seconds
of suspending (Genki Sky). [Verified that that's because systemd uses
CLOCK_MONOTONIC and expects it to not include the suspend time.]
* systemd-journald misbehaves after resume:
systemd-journald[7266]: File /var/log/journal/016627c3c4784cd4812d4b7e96a34226/system.journal
corrupted or uncleanly shut down, renaming and replacing.
(Mike Galbraith).
* NetworkManager reports "networking disabled" and networking is broken
after resume 50% of the time (Pavel). [May be because of systemd.]
* MATE desktop dims the display and starts the screensaver right after
system resume (Pavel).
* Full system hang during resume (me). [May be due to systemd or NM or both.]
That happens on debian and open suse systems.
It's sad, that these problems were neither catched in -next nor by those
folks who expressed interest in this change.
Reported-by: Rafael J. Wysocki <rjw@rjwysocki.net>
Reported-by: Genki Sky <sky@genki.is>,
Reported-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Cc: John Stultz <john.stultz@linaro.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kevin Easton <kevin@guarana.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Mark Salyzyn <salyzyn@android.com>
Cc: Michael Kerrisk <mtk.manpages@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'include/linux/timekeeping.h')
-rw-r--r-- | include/linux/timekeeping.h | 37 |
1 files changed, 25 insertions, 12 deletions
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 9737fbec7019..588a0e4b1ab9 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
@@ -33,25 +33,20 @@ extern void ktime_get_ts64(struct timespec64 *ts); | |||
33 | extern time64_t ktime_get_seconds(void); | 33 | extern time64_t ktime_get_seconds(void); |
34 | extern time64_t __ktime_get_real_seconds(void); | 34 | extern time64_t __ktime_get_real_seconds(void); |
35 | extern time64_t ktime_get_real_seconds(void); | 35 | extern time64_t ktime_get_real_seconds(void); |
36 | extern void ktime_get_active_ts64(struct timespec64 *ts); | ||
37 | 36 | ||
38 | extern int __getnstimeofday64(struct timespec64 *tv); | 37 | extern int __getnstimeofday64(struct timespec64 *tv); |
39 | extern void getnstimeofday64(struct timespec64 *tv); | 38 | extern void getnstimeofday64(struct timespec64 *tv); |
40 | extern void getboottime64(struct timespec64 *ts); | 39 | extern void getboottime64(struct timespec64 *ts); |
41 | 40 | ||
42 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) | 41 | #define ktime_get_real_ts64(ts) getnstimeofday64(ts) |
43 | |||
44 | /* Clock BOOTTIME compatibility wrappers */ | ||
45 | static inline void get_monotonic_boottime64(struct timespec64 *ts) | ||
46 | { | ||
47 | ktime_get_ts64(ts); | ||
48 | } | ||
49 | 42 | ||
50 | /* | 43 | /* |
51 | * ktime_t based interfaces | 44 | * ktime_t based interfaces |
52 | */ | 45 | */ |
46 | |||
53 | enum tk_offsets { | 47 | enum tk_offsets { |
54 | TK_OFFS_REAL, | 48 | TK_OFFS_REAL, |
49 | TK_OFFS_BOOT, | ||
55 | TK_OFFS_TAI, | 50 | TK_OFFS_TAI, |
56 | TK_OFFS_MAX, | 51 | TK_OFFS_MAX, |
57 | }; | 52 | }; |
@@ -62,10 +57,6 @@ extern ktime_t ktime_mono_to_any(ktime_t tmono, enum tk_offsets offs); | |||
62 | extern ktime_t ktime_get_raw(void); | 57 | extern ktime_t ktime_get_raw(void); |
63 | extern u32 ktime_get_resolution_ns(void); | 58 | extern u32 ktime_get_resolution_ns(void); |
64 | 59 | ||
65 | /* Clock BOOTTIME compatibility wrappers */ | ||
66 | static inline ktime_t ktime_get_boottime(void) { return ktime_get(); } | ||
67 | static inline u64 ktime_get_boot_ns(void) { return ktime_get(); } | ||
68 | |||
69 | /** | 60 | /** |
70 | * ktime_get_real - get the real (wall-) time in ktime_t format | 61 | * ktime_get_real - get the real (wall-) time in ktime_t format |
71 | */ | 62 | */ |
@@ -75,6 +66,17 @@ static inline ktime_t ktime_get_real(void) | |||
75 | } | 66 | } |
76 | 67 | ||
77 | /** | 68 | /** |
69 | * ktime_get_boottime - Returns monotonic time since boot in ktime_t format | ||
70 | * | ||
71 | * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the | ||
72 | * time spent in suspend. | ||
73 | */ | ||
74 | static inline ktime_t ktime_get_boottime(void) | ||
75 | { | ||
76 | return ktime_get_with_offset(TK_OFFS_BOOT); | ||
77 | } | ||
78 | |||
79 | /** | ||
78 | * ktime_get_clocktai - Returns the TAI time of day in ktime_t format | 80 | * ktime_get_clocktai - Returns the TAI time of day in ktime_t format |
79 | */ | 81 | */ |
80 | static inline ktime_t ktime_get_clocktai(void) | 82 | static inline ktime_t ktime_get_clocktai(void) |
@@ -100,6 +102,11 @@ static inline u64 ktime_get_real_ns(void) | |||
100 | return ktime_to_ns(ktime_get_real()); | 102 | return ktime_to_ns(ktime_get_real()); |
101 | } | 103 | } |
102 | 104 | ||
105 | static inline u64 ktime_get_boot_ns(void) | ||
106 | { | ||
107 | return ktime_to_ns(ktime_get_boottime()); | ||
108 | } | ||
109 | |||
103 | static inline u64 ktime_get_tai_ns(void) | 110 | static inline u64 ktime_get_tai_ns(void) |
104 | { | 111 | { |
105 | return ktime_to_ns(ktime_get_clocktai()); | 112 | return ktime_to_ns(ktime_get_clocktai()); |
@@ -112,11 +119,17 @@ static inline u64 ktime_get_raw_ns(void) | |||
112 | 119 | ||
113 | extern u64 ktime_get_mono_fast_ns(void); | 120 | extern u64 ktime_get_mono_fast_ns(void); |
114 | extern u64 ktime_get_raw_fast_ns(void); | 121 | extern u64 ktime_get_raw_fast_ns(void); |
122 | extern u64 ktime_get_boot_fast_ns(void); | ||
115 | extern u64 ktime_get_real_fast_ns(void); | 123 | extern u64 ktime_get_real_fast_ns(void); |
116 | 124 | ||
117 | /* | 125 | /* |
118 | * timespec64 interfaces utilizing the ktime based ones | 126 | * timespec64 interfaces utilizing the ktime based ones |
119 | */ | 127 | */ |
128 | static inline void get_monotonic_boottime64(struct timespec64 *ts) | ||
129 | { | ||
130 | *ts = ktime_to_timespec64(ktime_get_boottime()); | ||
131 | } | ||
132 | |||
120 | static inline void timekeeping_clocktai64(struct timespec64 *ts) | 133 | static inline void timekeeping_clocktai64(struct timespec64 *ts) |
121 | { | 134 | { |
122 | *ts = ktime_to_timespec64(ktime_get_clocktai()); | 135 | *ts = ktime_to_timespec64(ktime_get_clocktai()); |