[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250506091534.42117-11-gmonaco@redhat.com>
Date: Tue, 6 May 2025 11:15:39 +0200
From: Gabriele Monaco <gmonaco@...hat.com>
To: linux-kernel@...r.kernel.org,
Frederic Weisbecker <frederic@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Waiman Long <longman@...hat.com>
Cc: Gabriele Monaco <gmonaco@...hat.com>
Subject: [PATCH v4 4/5] timers: Add timer_base_remote_is_idle to query from remote cpus
The function timer_base_is_idle allows to query if the current CPU's
timer base is set to idle. There's currently no way to get the same
information for a remote CPU.
Add timer_base_remote_is_idle that given a CPU number returns the timer
base idle state of that CPU.
Signed-off-by: Gabriele Monaco <gmonaco@...hat.com>
---
kernel/time/tick-internal.h | 1 +
kernel/time/timer.c | 11 +++++++++++
2 files changed, 12 insertions(+)
diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h
index faac36de35b9..75580f7c69c6 100644
--- a/kernel/time/tick-internal.h
+++ b/kernel/time/tick-internal.h
@@ -167,6 +167,7 @@ extern void fetch_next_timer_interrupt_remote(unsigned long basej, u64 basem,
extern void timer_lock_remote_bases(unsigned int cpu);
extern void timer_unlock_remote_bases(unsigned int cpu);
extern bool timer_base_is_idle(void);
+extern bool timer_base_remote_is_idle(unsigned int cpu);
extern void timer_expire_remote(unsigned int cpu);
# endif
#else /* CONFIG_NO_HZ_COMMON */
diff --git a/kernel/time/timer.c b/kernel/time/timer.c
index 4d915c0a263c..f7fbd3b3cb83 100644
--- a/kernel/time/timer.c
+++ b/kernel/time/timer.c
@@ -2162,6 +2162,17 @@ bool timer_base_is_idle(void)
return __this_cpu_read(timer_bases[BASE_LOCAL].is_idle);
}
+/**
+ * timer_base_remote_is_idle() - Return whether timer base is set idle for cpu
+ * @cpu: Remote CPU
+ *
+ * Returns value of local timer base is_idle value for remote cpu.
+ */
+bool timer_base_remote_is_idle(unsigned int cpu)
+{
+ return per_cpu(timer_bases[BASE_LOCAL].is_idle, cpu);
+}
+
static void __run_timer_base(struct timer_base *base);
/**
--
2.49.0
Powered by blists - more mailing lists