From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linuxfoundation.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Steven Rostedt <rostedt@goodmis.org>,
John Stultz <john.stultz@linaro.org>,
Petr Mladek <pmladek@suse.com>,
Mark Salyzyn <salyzyn@android.com>,
Prarit Bhargava <prarit@redhat.com>,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Kevin Easton <kevin@guarana.org>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Jonathan Corbet <corbet@lwn.net>
Subject: [RFC/RFT patch 4/7] timekeeping: Remove boot time specific code
Date: Thu, 01 Mar 2018 17:33:35 +0100 [thread overview]
Message-ID: <20180301165150.236279497@linutronix.de> (raw)
In-Reply-To: 20180301163331.987775783@linutronix.de
[-- Attachment #1: timekeeping--Remove-boot-time-specific-code.patch --]
[-- Type: text/plain, Size: 4736 bytes --]
Now that clock MONOTONIC and clock BOOTTIME are the same, remove all the
special handling from timekeeping. Keep wrappers for the existing users of
the *boot* timekeeper interfaces.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
include/linux/timekeeping.h | 42 +++++++++++++++++-------------------------
kernel/time/timekeeping.c | 31 -------------------------------
2 files changed, 17 insertions(+), 56 deletions(-)
--- a/include/linux/timekeeping.h
+++ b/include/linux/timekeeping.h
@@ -38,15 +38,19 @@ extern int __getnstimeofday64(struct tim
extern void getnstimeofday64(struct timespec64 *tv);
extern void getboottime64(struct timespec64 *ts);
-#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
+#define ktime_get_real_ts64(ts) getnstimeofday64(ts)
+
+/* Clock BOOTTIME compatibility wrappers */
+static inline void get_monotonic_boottime64(struct timespec64 *ts)
+{
+ ktime_get_ts64(ts);
+}
/*
* ktime_t based interfaces
*/
-
enum tk_offsets {
TK_OFFS_REAL,
- TK_OFFS_BOOT,
TK_OFFS_TAI,
TK_OFFS_MAX,
};
@@ -57,6 +61,10 @@ extern ktime_t ktime_mono_to_any(ktime_t
extern ktime_t ktime_get_raw(void);
extern u32 ktime_get_resolution_ns(void);
+/* Clock BOOTTIME compatibility wrappers */
+static inline ktime_t ktime_get_boottime(void) { return ktime_get(); }
+static inline u64 ktime_get_boot_ns(void) { return ktime_get(); }
+
/**
* ktime_get_real - get the real (wall-) time in ktime_t format
*/
@@ -66,17 +74,6 @@ static inline ktime_t ktime_get_real(voi
}
/**
- * ktime_get_boottime - Returns monotonic time since boot in ktime_t format
- *
- * This is similar to CLOCK_MONTONIC/ktime_get, but also includes the
- * time spent in suspend.
- */
-static inline ktime_t ktime_get_boottime(void)
-{
- return ktime_get_with_offset(TK_OFFS_BOOT);
-}
-
-/**
* ktime_get_clocktai - Returns the TAI time of day in ktime_t format
*/
static inline ktime_t ktime_get_clocktai(void)
@@ -102,11 +99,6 @@ static inline u64 ktime_get_real_ns(void
return ktime_to_ns(ktime_get_real());
}
-static inline u64 ktime_get_boot_ns(void)
-{
- return ktime_to_ns(ktime_get_boottime());
-}
-
static inline u64 ktime_get_tai_ns(void)
{
return ktime_to_ns(ktime_get_clocktai());
@@ -119,17 +111,17 @@ static inline u64 ktime_get_raw_ns(void)
extern u64 ktime_get_mono_fast_ns(void);
extern u64 ktime_get_raw_fast_ns(void);
-extern u64 ktime_get_boot_fast_ns(void);
extern u64 ktime_get_real_fast_ns(void);
-/*
- * timespec64 interfaces utilizing the ktime based ones
- */
-static inline void get_monotonic_boottime64(struct timespec64 *ts)
+/* Clock BOOTTIME compatibility wrappers */
+static inline u64 ktime_get_boot_fast_ns(void)
{
- *ts = ktime_to_timespec64(ktime_get_boottime());
+ return ktime_get_mono_fast_ns();
}
+/*
+ * timespec64 interfaces utilizing the ktime based ones
+ */
static inline void timekeeping_clocktai64(struct timespec64 *ts)
{
*ts = ktime_to_timespec64(ktime_get_clocktai());
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -472,36 +472,6 @@ u64 ktime_get_raw_fast_ns(void)
}
EXPORT_SYMBOL_GPL(ktime_get_raw_fast_ns);
-/**
- * ktime_get_boot_fast_ns - NMI safe and fast access to boot clock.
- *
- * To keep it NMI safe since we're accessing from tracing, we're not using a
- * separate timekeeper with updates to monotonic clock and boot offset
- * protected with seqlocks. This has the following minor side effects:
- *
- * (1) Its possible that a timestamp be taken after the boot offset is updated
- * but before the timekeeper is updated. If this happens, the new boot offset
- * is added to the old timekeeping making the clock appear to update slightly
- * earlier:
- * CPU 0 CPU 1
- * timekeeping_inject_sleeptime64()
- * __timekeeping_inject_sleeptime(tk, delta);
- * timestamp();
- * timekeeping_update(tk, TK_CLEAR_NTP...);
- *
- * (2) On 32-bit systems, the 64-bit boot offset (tk->offs_boot) may be
- * partially updated. Since the tk->offs_boot update is a rare event, this
- * should be a rare occurrence which postprocessing should be able to handle.
- */
-u64 notrace ktime_get_boot_fast_ns(void)
-{
- struct timekeeper *tk = &tk_core.timekeeper;
-
- return (ktime_get_mono_fast_ns() + ktime_to_ns(tk->offs_boot));
-}
-EXPORT_SYMBOL_GPL(ktime_get_boot_fast_ns);
-
-
/*
* See comment for __ktime_get_fast_ns() vs. timestamp ordering
*/
@@ -793,7 +763,6 @@ EXPORT_SYMBOL_GPL(ktime_get_resolution_n
static ktime_t *offsets[TK_OFFS_MAX] = {
[TK_OFFS_REAL] = &tk_core.timekeeper.offs_real,
- [TK_OFFS_BOOT] = &tk_core.timekeeper.offs_boot,
[TK_OFFS_TAI] = &tk_core.timekeeper.offs_tai,
};
next prev parent reply other threads:[~2018-03-01 16:53 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 16:33 [RFC/RFT patch 0/7] timekeeping: Unify clock MONOTONIC and clock BOOTTIME Thomas Gleixner
2018-03-01 16:33 ` [RFC/RFT patch 1/7] timekeeping: Provide CLOCK_MONOTONIC_ACTIVE Thomas Gleixner
2018-03-13 7:06 ` [tip:timers/core] timekeeping: Add the new CLOCK_MONOTONIC_ACTIVE clock tip-bot for Thomas Gleixner
2018-03-01 16:33 ` [RFC/RFT patch 2/7] timekeeping: Make clock MONOTONIC behave like clock BOOTTIME Thomas Gleixner
2018-03-13 7:07 ` [tip:timers/core] timekeeping: Make the MONOTONIC clock behave like the BOOTTIME clock tip-bot for Thomas Gleixner
2018-03-01 16:33 ` [RFC/RFT patch 3/7] Input: evdev - Conflate clock MONOTONIC and BOOTTIME Thomas Gleixner
2018-03-13 7:07 ` [tip:timers/core] Input: Evdev - unify MONOTONIC and BOOTTIME clock behavior tip-bot for Thomas Gleixner
2018-03-01 16:33 ` Thomas Gleixner [this message]
2018-03-13 7:08 ` [tip:timers/core] timekeeping: Remove boot time specific code tip-bot for Thomas Gleixner
2018-03-01 16:33 ` [RFC/RFT patch 5/7] posix-timers: Conflate clock MONOTONIC and BOOTTIME Thomas Gleixner
2018-03-13 7:08 ` [tip:timers/core] posix-timers: Unify MONOTONIC and BOOTTIME clock behavior tip-bot for Thomas Gleixner
2018-03-01 16:33 ` [RFC/RFT patch 6/7] hrtimer: Conflate clock MONOTONIC and BOOTTIME Thomas Gleixner
2018-03-13 7:09 ` [tip:timers/core] hrtimer: Unify MONOTONIC and BOOTTIME clock behavior tip-bot for Thomas Gleixner
2018-03-01 16:33 ` [RFC/RFT patch 7/7] tracing: Conflate boot and monotonic clock Thomas Gleixner
2018-03-13 7:09 ` [tip:timers/core] tracing: Unify the "boot" and "mono" tracing clocks tip-bot for Thomas Gleixner
2018-03-01 17:23 ` [RFC/RFT patch 0/7] timekeeping: Unify clock MONOTONIC and clock BOOTTIME Linus Torvalds
2018-03-01 18:41 ` Thomas Gleixner
2018-03-01 18:50 ` Steven Rostedt
2018-03-01 19:10 ` Thomas Gleixner
2018-03-13 6:36 ` Ingo Molnar
2018-03-13 18:11 ` John Stultz
2018-04-20 4:37 ` David Herrmann
2018-04-20 5:44 ` Sergey Senozhatsky
2018-04-20 6:49 ` David Herrmann
2018-04-24 0:40 ` Genki Sky
2018-04-24 2:45 ` Genki Sky
2018-04-24 3:03 ` John Stultz
2018-04-24 8:09 ` Thomas Gleixner
2018-04-24 12:11 ` Genki Sky
2018-04-24 15:00 ` Thomas Gleixner
2018-04-25 6:50 ` Pavel Machek
2018-04-25 8:55 ` Rafael J. Wysocki
2018-04-25 8:52 ` Rafael J. Wysocki
2018-04-25 9:49 ` Rafael J. Wysocki
2018-04-25 13:03 ` Thomas Gleixner
2018-04-26 7:03 ` Mike Galbraith
2018-04-26 7:42 ` Thomas Gleixner
2018-04-26 8:36 ` Rafael J. Wysocki
2018-04-26 8:51 ` Thomas Gleixner
2018-04-26 9:03 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180301165150.236279497@linutronix.de \
--to=tglx@linutronix.de \
--cc=corbet@lwn.net \
--cc=dmitry.torokhov@gmail.com \
--cc=john.stultz@linaro.org \
--cc=kevin@guarana.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=prarit@redhat.com \
--cc=rostedt@goodmis.org \
--cc=salyzyn@android.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=torvalds@linuxfoundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).