Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 127bfa5f authored by Thomas Gleixner's avatar Thomas Gleixner Committed by Ingo Molnar
Browse files

hrtimer: Unify MONOTONIC and BOOTTIME clock behavior



Now that th MONOTONIC and BOOTTIME clocks are indentical remove all the special
casing.

The user space visible interfaces still support both clocks, but their behavior
is identical.

Signed-off-by: default avatarThomas 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>
Link: http://lkml.kernel.org/r/20180301165150.410218515@linutronix.de


Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent 7250a404
Loading
Loading
Loading
Loading
+0 −2
Original line number Original line Diff line number Diff line
@@ -161,11 +161,9 @@ struct hrtimer_clock_base {
enum  hrtimer_base_type {
enum  hrtimer_base_type {
	HRTIMER_BASE_MONOTONIC,
	HRTIMER_BASE_MONOTONIC,
	HRTIMER_BASE_REALTIME,
	HRTIMER_BASE_REALTIME,
	HRTIMER_BASE_BOOTTIME,
	HRTIMER_BASE_TAI,
	HRTIMER_BASE_TAI,
	HRTIMER_BASE_MONOTONIC_SOFT,
	HRTIMER_BASE_MONOTONIC_SOFT,
	HRTIMER_BASE_REALTIME_SOFT,
	HRTIMER_BASE_REALTIME_SOFT,
	HRTIMER_BASE_BOOTTIME_SOFT,
	HRTIMER_BASE_TAI_SOFT,
	HRTIMER_BASE_TAI_SOFT,
	HRTIMER_MAX_CLOCK_BASES,
	HRTIMER_MAX_CLOCK_BASES,
};
};
+2 −14
Original line number Original line Diff line number Diff line
@@ -90,11 +90,6 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
			.clockid = CLOCK_REALTIME,
			.clockid = CLOCK_REALTIME,
			.get_time = &ktime_get_real,
			.get_time = &ktime_get_real,
		},
		},
		{
			.index = HRTIMER_BASE_BOOTTIME,
			.clockid = CLOCK_BOOTTIME,
			.get_time = &ktime_get_boottime,
		},
		{
		{
			.index = HRTIMER_BASE_TAI,
			.index = HRTIMER_BASE_TAI,
			.clockid = CLOCK_TAI,
			.clockid = CLOCK_TAI,
@@ -110,11 +105,6 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
			.clockid = CLOCK_REALTIME,
			.clockid = CLOCK_REALTIME,
			.get_time = &ktime_get_real,
			.get_time = &ktime_get_real,
		},
		},
		{
			.index = HRTIMER_BASE_BOOTTIME_SOFT,
			.clockid = CLOCK_BOOTTIME,
			.get_time = &ktime_get_boottime,
		},
		{
		{
			.index = HRTIMER_BASE_TAI_SOFT,
			.index = HRTIMER_BASE_TAI_SOFT,
			.clockid = CLOCK_TAI,
			.clockid = CLOCK_TAI,
@@ -129,7 +119,7 @@ static const int hrtimer_clock_to_base_table[MAX_CLOCKS] = {


	[CLOCK_REALTIME]	= HRTIMER_BASE_REALTIME,
	[CLOCK_REALTIME]	= HRTIMER_BASE_REALTIME,
	[CLOCK_MONOTONIC]	= HRTIMER_BASE_MONOTONIC,
	[CLOCK_MONOTONIC]	= HRTIMER_BASE_MONOTONIC,
	[CLOCK_BOOTTIME]	= HRTIMER_BASE_BOOTTIME,
	[CLOCK_BOOTTIME]	= HRTIMER_BASE_MONOTONIC,
	[CLOCK_TAI]		= HRTIMER_BASE_TAI,
	[CLOCK_TAI]		= HRTIMER_BASE_TAI,
};
};


@@ -565,14 +555,12 @@ __hrtimer_get_next_event(struct hrtimer_cpu_base *cpu_base, unsigned int active_
static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
static inline ktime_t hrtimer_update_base(struct hrtimer_cpu_base *base)
{
{
	ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
	ktime_t *offs_real = &base->clock_base[HRTIMER_BASE_REALTIME].offset;
	ktime_t *offs_boot = &base->clock_base[HRTIMER_BASE_BOOTTIME].offset;
	ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset;
	ktime_t *offs_tai = &base->clock_base[HRTIMER_BASE_TAI].offset;


	ktime_t now = ktime_get_update_offsets_now(&base->clock_was_set_seq,
	ktime_t now = ktime_get_update_offsets_now(&base->clock_was_set_seq,
					    offs_real, offs_boot, offs_tai);
						   offs_real, offs_tai);


	base->clock_base[HRTIMER_BASE_REALTIME_SOFT].offset = *offs_real;
	base->clock_base[HRTIMER_BASE_REALTIME_SOFT].offset = *offs_real;
	base->clock_base[HRTIMER_BASE_BOOTTIME_SOFT].offset = *offs_boot;
	base->clock_base[HRTIMER_BASE_TAI_SOFT].offset = *offs_tai;
	base->clock_base[HRTIMER_BASE_TAI_SOFT].offset = *offs_tai;


	return now;
	return now;
+1 −3
Original line number Original line Diff line number Diff line
@@ -2195,7 +2195,6 @@ void do_timer(unsigned long ticks)
 * ktime_get_update_offsets_now - hrtimer helper
 * ktime_get_update_offsets_now - hrtimer helper
 * @cwsseq:	pointer to check and store the clock was set sequence number
 * @cwsseq:	pointer to check and store the clock was set sequence number
 * @offs_real:	pointer to storage for monotonic -> realtime offset
 * @offs_real:	pointer to storage for monotonic -> realtime offset
 * @offs_boot:	pointer to storage for monotonic -> boottime offset
 * @offs_tai:	pointer to storage for monotonic -> clock tai offset
 * @offs_tai:	pointer to storage for monotonic -> clock tai offset
 *
 *
 * Returns current monotonic time and updates the offsets if the
 * Returns current monotonic time and updates the offsets if the
@@ -2205,7 +2204,7 @@ void do_timer(unsigned long ticks)
 * Called from hrtimer_interrupt() or retrigger_next_event()
 * Called from hrtimer_interrupt() or retrigger_next_event()
 */
 */
ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real,
ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real,
				     ktime_t *offs_boot, ktime_t *offs_tai)
				     ktime_t *offs_tai)
{
{
	struct timekeeper *tk = &tk_core.timekeeper;
	struct timekeeper *tk = &tk_core.timekeeper;
	unsigned int seq;
	unsigned int seq;
@@ -2222,7 +2221,6 @@ ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq, ktime_t *offs_real,
		if (*cwsseq != tk->clock_was_set_seq) {
		if (*cwsseq != tk->clock_was_set_seq) {
			*cwsseq = tk->clock_was_set_seq;
			*cwsseq = tk->clock_was_set_seq;
			*offs_real = tk->offs_real;
			*offs_real = tk->offs_real;
			*offs_boot = tk->offs_boot;
			*offs_tai = tk->offs_tai;
			*offs_tai = tk->offs_tai;
		}
		}


+0 −1
Original line number Original line Diff line number Diff line
@@ -6,7 +6,6 @@
 */
 */
extern ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq,
extern ktime_t ktime_get_update_offsets_now(unsigned int *cwsseq,
					    ktime_t *offs_real,
					    ktime_t *offs_real,
					    ktime_t *offs_boot,
					    ktime_t *offs_tai);
					    ktime_t *offs_tai);


extern int timekeeping_valid_for_hres(void);
extern int timekeeping_valid_for_hres(void);