All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Subject: [patch 11/11] hrtimer: Make hrtimer_forward() private to core timer code
Date: Thu, 23 Sep 2021 18:04:37 +0200 (CEST)	[thread overview]
Message-ID: <20210923153340.054751351@linutronix.de> (raw)
In-Reply-To: 20210923153311.225307347@linutronix.de

hrtimer_forward() invites to be used in the wrong way and there is no real
requirement to have it outside of the timers core code.

All users outside of the timer core code have been converted to
hrtimer_forward_now() which provides all what the non-core code usage
needs.

Export hrtimer_forward_now() instead and move the prototype to a timer core
header.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 include/linux/hrtimer.h     |   26 +-------------------------
 kernel/time/hrtimer.c       |   23 ++++++++++++++++++++++-
 kernel/time/posix-timers.c  |    1 +
 kernel/time/tick-internal.h |    1 +
 4 files changed, 25 insertions(+), 26 deletions(-)

--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -480,31 +480,7 @@ static inline int hrtimer_callback_runni
 	return timer->base->running == timer;
 }
 
-/* Forward a hrtimer so it expires after now: */
-extern u64
-hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
-
-/**
- * hrtimer_forward_now - forward the timer expiry so it expires after now
- * @timer:	hrtimer to forward
- * @interval:	the interval to forward
- *
- * Forward the timer expiry so it will expire after the current time
- * of the hrtimer clock base. Returns the number of overruns.
- *
- * Can be safely called from the callback function of @timer. If
- * called from other contexts @timer must neither be enqueued nor
- * running the callback and the caller needs to take care of
- * serialization.
- *
- * Note: This only updates the timer expiry value and does not requeue
- * the timer.
- */
-static inline u64 hrtimer_forward_now(struct hrtimer *timer,
-				      ktime_t interval)
-{
-	return hrtimer_forward(timer, timer->base->get_time(), interval);
-}
+extern u64 hrtimer_forward_now(struct hrtimer *timer, ktime_t interval);
 
 /* Precise sleep: */
 
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1067,7 +1067,28 @@ u64 hrtimer_forward(struct hrtimer *time
 
 	return orun;
 }
-EXPORT_SYMBOL_GPL(hrtimer_forward);
+
+/**
+ * hrtimer_forward_now - forward the timer expiry so it expires after now
+ * @timer:	hrtimer to forward
+ * @interval:	the interval to forward
+ *
+ * Forward the timer expiry so it will expire after the current time
+ * of the hrtimer clock base. Returns the number of overruns.
+ *
+ * Can be safely called from the callback function of @timer. If
+ * called from other contexts @timer must neither be enqueued nor
+ * running the callback and the caller needs to take care of
+ * serialization.
+ *
+ * Note: This only updates the timer expiry value and does not requeue
+ * the timer.
+ */
+extern u64 hrtimer_forward_now(struct hrtimer *timer, ktime_t interval)
+{
+	return hrtimer_forward(timer, timer->base->get_time(), interval);
+}
+EXPORT_SYMBOL_GPL(hrtimer_forward_now);
 
 /*
  * enqueue_hrtimer - internal function to (re)start a timer
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -33,6 +33,7 @@
 #include <linux/time_namespace.h>
 
 #include "timekeeping.h"
+#include "tick-internal.h"
 #include "posix-timers.h"
 
 /*
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -177,6 +177,7 @@ void clock_was_set(unsigned int bases);
 void clock_was_set_delayed(void);
 
 void hrtimers_resume_local(void);
+u64 hrtimer_forward(struct hrtimer *timer, ktime_t now, ktime_t interval);
 
 /* Since jiffies uses a simple TICK_NSEC multiplier
  * conversion, the .shift value could be zero. However


      parent reply	other threads:[~2021-09-23 16:05 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-23 16:04 [patch 00/11] hrtimers: Cleanup hrtimer_forward() [ab]use Thomas Gleixner
2021-09-23 16:04 ` [Intel-gfx] " Thomas Gleixner
2021-09-23 16:04 ` Thomas Gleixner
2021-09-23 16:04 ` [patch 01/11] hrtimer: Add a mechanism to catch runaway timers Thomas Gleixner
2021-09-24  8:16   ` Dmitry Vyukov
2021-09-23 16:04 ` [patch 02/11] mac80211-hwsim: Fix late beacon hrtimer handling Thomas Gleixner
2021-09-23 16:04 ` [patch 03/11] net: iosm: Use hrtimer_forward_now() Thomas Gleixner
2021-09-23 16:04 ` [patch 04/11] ALSA: pcsp: Make hrtimer forwarding more robust Thomas Gleixner
2021-09-23 16:04   ` Thomas Gleixner
2021-09-28  8:58   ` Takashi Iwai
2021-09-28  8:58     ` Takashi Iwai
2021-09-23 16:04 ` [patch 05/11] can: bcm: Use hrtimer_forward_now() Thomas Gleixner
2021-10-13 13:59   ` Marc Kleine-Budde
2021-09-23 16:04 ` [patch 06/11] power: reset: ltc2952: " Thomas Gleixner
2021-09-27 12:34   ` Sebastian Reichel
2021-09-23 16:04 ` [patch 07/11] drm/i915/pmu: " Thomas Gleixner
2021-09-23 16:04   ` [Intel-gfx] " Thomas Gleixner
2021-09-24  9:03   ` Tvrtko Ursulin
2021-09-23 16:04 ` [patch 08/11] signal: Move itimer rearming into itimer code Thomas Gleixner
2021-09-23 16:04 ` [patch 09/11] posix-timers: Fixup stale commnt and reduce ifdeffery Thomas Gleixner
2021-09-23 16:04 ` [patch 10/11] posix-timers: Use hrtimer_forward_now() Thomas Gleixner
2021-09-23 16:04 ` Thomas Gleixner [this message]

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=20210923153340.054751351@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.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 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.