[PATCH] hrtimer:Add get_hrtimer_cpu_base()

From: Enlin Mu
Date: Wed Mar 13 2024 - 01:31:12 EST


From: Enlin Mu <enlin.mu@xxxxxxxxxx>

On the Arm platform,arch_timer may occur irq strom,
By using the next_timer of hrtimer_cpu_base, it is
possible to quickly locate abnormal timers.
As it is an out of tree modules,the function needs
to be exproted.

Signed-off-by: Enlin Mu <enlin.mu@xxxxxxxxxx>
---
include/linux/hrtimer.h | 1 +
kernel/time/hrtimer.c | 6 ++++++
2 files changed, 7 insertions(+)

diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h
index aa1e65ccb615..2a37d2a8e808 100644
--- a/include/linux/hrtimer.h
+++ b/include/linux/hrtimer.h
@@ -277,6 +277,7 @@ static inline void hrtimer_start(struct hrtimer *timer, ktime_t tim,

extern int hrtimer_cancel(struct hrtimer *timer);
extern int hrtimer_try_to_cancel(struct hrtimer *timer);
+extern struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu);

static inline void hrtimer_start_expires(struct hrtimer *timer,
enum hrtimer_mode mode)
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 70625dff62ce..f7cf7d48b91d 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1309,6 +1309,12 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
}
EXPORT_SYMBOL_GPL(hrtimer_start_range_ns);

+struct hrtimer_cpu_base *get_hrtimer_cpu_base(int cpu)
+{
+ return &per_cpu(hrtimer_bases, cpu);
+}
+EXPORT_SYMBOL_GPL(get_hrtimer_cpu_base);
+
/**
* hrtimer_try_to_cancel - try to deactivate a timer
* @timer: hrtimer to stop
--
2.39.2