From: Peter Zijlstra <peterz@infradead.org>
To: "Thomas Weißschuh" <thomas.weissschuh@linutronix.de>
Cc: Anna-Maria Behnsen <anna-maria@linutronix.de>,
Frederic Weisbecker <frederic@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>,
Juri Lelli <juri.lelli@redhat.com>,
Vincent Guittot <vincent.guittot@linaro.org>,
Dietmar Eggemann <dietmar.eggemann@arm.com>,
Steven Rostedt <rostedt@goodmis.org>,
Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
Valentin Schneider <vschneid@redhat.com>,
Matt Wu <wuqiang.matt@bytedance.com>,
Andrew Morton <akpm@linux-foundation.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Sean Young <sean@mess.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Jan Kiszka <jan.kiszka@siemens.com>,
Kieran Bingham <kbingham@kernel.org>,
linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH 8/8] hrtimer: Remove hrtimer_clock_base::get_time
Date: Tue, 12 Aug 2025 09:42:46 +0200 [thread overview]
Message-ID: <20250812074246.GC4067720@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <20250812-hrtimer-cleanup-get_time-v1-8-b962cd9d9385@linutronix.de>
On Tue, Aug 12, 2025 at 08:08:16AM +0200, Thomas Weißschuh wrote:
> @@ -76,42 +77,34 @@ DEFINE_PER_CPU(struct hrtimer_cpu_base, hrtimer_bases) =
> {
> .index = HRTIMER_BASE_MONOTONIC,
> .clockid = CLOCK_MONOTONIC,
> - .get_time = &ktime_get,
> },
> {
> .index = HRTIMER_BASE_REALTIME,
> .clockid = CLOCK_REALTIME,
> - .get_time = &ktime_get_real,
> },
> {
> .index = HRTIMER_BASE_BOOTTIME,
> .clockid = CLOCK_BOOTTIME,
> - .get_time = &ktime_get_boottime,
> },
> {
> .index = HRTIMER_BASE_TAI,
> .clockid = CLOCK_TAI,
> - .get_time = &ktime_get_clocktai,
> },
> {
> .index = HRTIMER_BASE_MONOTONIC_SOFT,
> .clockid = CLOCK_MONOTONIC,
> - .get_time = &ktime_get,
> },
> {
> .index = HRTIMER_BASE_REALTIME_SOFT,
> .clockid = CLOCK_REALTIME,
> - .get_time = &ktime_get_real,
> },
> {
> .index = HRTIMER_BASE_BOOTTIME_SOFT,
> .clockid = CLOCK_BOOTTIME,
> - .get_time = &ktime_get_boottime,
> },
> {
> .index = HRTIMER_BASE_TAI_SOFT,
> .clockid = CLOCK_TAI,
> - .get_time = &ktime_get_clocktai,
> },
> },
> .csd = CSD_INIT(retrigger_next_event, NULL)
> @@ -1253,7 +1246,7 @@ static int __hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
> remove_hrtimer(timer, base, true, force_local);
>
> if (mode & HRTIMER_MODE_REL)
> - tim = ktime_add_safe(tim, base->get_time());
> + tim = ktime_add_safe(tim, __hrtimer_cb_get_time(base->clockid));
>
> tim = hrtimer_update_lowres(timer, tim, mode);
>
> @@ -1588,6 +1581,29 @@ static inline int hrtimer_clockid_to_base(clockid_t clock_id)
> }
> }
>
> +static ktime_t __hrtimer_cb_get_time(clockid_t clock_id)
> +{
> + switch (clock_id) {
> + case CLOCK_REALTIME:
> + return ktime_get_real();
> + case CLOCK_MONOTONIC:
> + return ktime_get();
> + case CLOCK_BOOTTIME:
> + return ktime_get_boottime();
> + case CLOCK_TAI:
> + return ktime_get_clocktai();
It would've been nice if these had the same order as the other array.
> + default:
> + WARN(1, "Invalid clockid %d. Using MONOTONIC\n", clock_id);
> + return ktime_get();
> + }
> +}
next prev parent reply other threads:[~2025-08-12 7:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-12 6:08 [PATCH 0/8] hrtimer: Remove hrtimer_clock_base::get_time Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 1/8] posix-timers: Avoid direct access to hrtimer clockbase Thomas Weißschuh
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 2/8] timers/itimer: " Thomas Weißschuh
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 3/8] sched/core: " Thomas Weißschuh
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 4/8] lib: test_objpool: " Thomas Weißschuh
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 5/8] ALSA: hrtimer: " Thomas Weißschuh
2025-08-12 11:07 ` Takashi Iwai
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 6/8] media: pwm-ir-tx: " Thomas Weißschuh
2025-08-12 12:06 ` Sean Young
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 7/8] hrtimer: Use hrtimer_cb_get_time() helper Thomas Weißschuh
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 6:08 ` [PATCH 8/8] hrtimer: Remove hrtimer_clock_base::get_time Thomas Weißschuh
2025-08-12 7:42 ` Peter Zijlstra [this message]
2025-08-12 7:51 ` Thomas Weißschuh
2025-09-09 8:56 ` [tip: timers/core] " tip-bot2 for Thomas Weißschuh
2025-08-12 7:43 ` [PATCH 0/8] " Peter Zijlstra
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=20250812074246.GC4067720@noisy.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=anna-maria@linutronix.de \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=frederic@kernel.org \
--cc=jan.kiszka@siemens.com \
--cc=juri.lelli@redhat.com \
--cc=kbingham@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=perex@perex.cz \
--cc=rostedt@goodmis.org \
--cc=sean@mess.org \
--cc=tglx@linutronix.de \
--cc=thomas.weissschuh@linutronix.de \
--cc=tiwai@suse.com \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.com \
--cc=wuqiang.matt@bytedance.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.