mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-kernel@vger.kernel.org,
	Frederic Weisbecker <frederic@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Waiman Long <longman@redhat.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Subject: [PATCH v4 4/5] timers: Add timer_base_remote_is_idle to query from remote cpus
Date: Tue,  6 May 2025 11:15:39 +0200	[thread overview]
Message-ID: <20250506091534.42117-11-gmonaco@redhat.com> (raw)
In-Reply-To: <20250506091534.42117-7-gmonaco@redhat.com>

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@redhat.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


  parent reply	other threads:[~2025-05-06  9:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06  9:15 [PATCH v4 0/5] timers: Exclude isolated cpus from timer migation Gabriele Monaco
2025-05-06  9:15 ` [PATCH v4 1/5] timers: Rename tmigr 'online' bit to 'available' Gabriele Monaco
2025-05-06  9:15 ` [PATCH v4 2/5] timers: Add the available mask in timer migration Gabriele Monaco
2025-05-06 16:07   ` Frederic Weisbecker
2025-05-07  7:57     ` Gabriele Monaco
2025-05-07 12:25       ` Frederic Weisbecker
2025-05-07 12:46         ` Gabriele Monaco
2025-05-07 13:40           ` Frederic Weisbecker
2025-05-07 13:54             ` Gabriele Monaco
2025-05-07 14:27               ` Frederic Weisbecker
2025-05-06  9:15 ` [PATCH v4 3/5] cgroup/cpuset: Rename update_unbound_workqueue_cpumask to update_exclusion_cpumasks Gabriele Monaco
2025-05-06  9:15 ` Gabriele Monaco [this message]
2025-05-06  9:15 ` [PATCH v4 5/5] timers: Exclude isolated cpus from timer migation Gabriele Monaco
2025-05-06 16:00   ` Frederic Weisbecker

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=20250506091534.42117-11-gmonaco@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=frederic@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=tglx@linutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®