public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Gabriele Monaco <gmonaco@redhat.com>
To: linux-kernel@vger.kernel.org,
	Anna-Maria Behnsen <anna-maria@linutronix.de>,
	Frederic Weisbecker <frederic@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Waiman Long <longman@redhat.com>
Cc: Gabriele Monaco <gmonaco@redhat.com>
Subject: [RESEND PATCH v13 1/9] timers/migration: Postpone online/offline callbacks registration to late initcall
Date: Mon, 20 Oct 2025 13:27:54 +0200	[thread overview]
Message-ID: <20251020112802.102451-2-gmonaco@redhat.com> (raw)
In-Reply-To: <20251020112802.102451-1-gmonaco@redhat.com>

From: Frederic Weisbecker <frederic@kernel.org>

During the early boot process, the default clocksource used for
timekeeping is the jiffies. Better clocksources can only be selected
once clocksource_done_booting() is called as an fs initcall.

NOHZ can only be enabled after that stage, making global timer migration
irrelevant up to that point.

The tree remains inactive before NOHZ is enabled anyway. Therefore it
makes sense to enable each CPUs to the tree only once that is setup.

Make the CPUs available to the tree on late initcall, after the right
clocksource had a chance to be selected. This will also simplify the
handling of domain isolated CPUs on further patches.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Gabriele Monaco <gmonaco@redhat.com>
---
 kernel/time/timer_migration.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index c0c54dc5314c..891891794b92 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1481,6 +1481,16 @@ static int tmigr_cpu_online(unsigned int cpu)
 	return 0;
 }
 
+/*
+ * NOHZ can only be enabled after clocksource_done_booting(). Don't
+ * bother trashing the cache in the tree before.
+ */
+static int __init tmigr_late_init(void)
+{
+	return cpuhp_setup_state(CPUHP_AP_TMIGR_ONLINE, "tmigr:online",
+				 tmigr_cpu_online, tmigr_cpu_offline);
+}
+
 static void tmigr_init_group(struct tmigr_group *group, unsigned int lvl,
 			     int node)
 {
@@ -1843,18 +1853,10 @@ static int __init tmigr_init(void)
 
 	ret = cpuhp_setup_state(CPUHP_TMIGR_PREPARE, "tmigr:prepare",
 				tmigr_cpu_prepare, NULL);
-	if (ret)
-		goto err;
-
-	ret = cpuhp_setup_state(CPUHP_AP_TMIGR_ONLINE, "tmigr:online",
-				tmigr_cpu_online, tmigr_cpu_offline);
-	if (ret)
-		goto err;
-
-	return 0;
-
 err:
-	pr_err("Timer migration setup failed\n");
+	if (ret)
+		pr_err("Timer migration setup failed\n");
 	return ret;
 }
 early_initcall(tmigr_init);
+late_initcall(tmigr_late_init);
-- 
2.51.0


  reply	other threads:[~2025-10-20 11:28 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-20 11:27 [RESEND PATCH v13 0/9] timers: Exclude isolated cpus from timer migration Gabriele Monaco
2025-10-20 11:27 ` Gabriele Monaco [this message]
2025-10-30 14:07   ` [RESEND PATCH v13 1/9] timers/migration: Postpone online/offline callbacks registration to late initcall Frederic Weisbecker
2025-10-20 11:27 ` [RESEND PATCH v13 2/9] timers: Rename tmigr 'online' bit to 'available' Gabriele Monaco
2025-10-20 11:27 ` [RESEND PATCH v13 3/9] timers: Add the available mask in timer migration Gabriele Monaco
2025-10-20 11:27 ` [RESEND PATCH v13 4/9] timers: Use scoped_guard when setting/clearing the tmigr available flag Gabriele Monaco
2025-10-20 11:27 ` [RESEND PATCH v13 5/9] cgroup/cpuset: Rename update_unbound_workqueue_cpumask() to update_exclusion_cpumasks() Gabriele Monaco
2025-10-20 11:27 ` [RESEND PATCH v13 6/9] sched/isolation: Force housekeeping if isolcpus and nohz_full don't leave any Gabriele Monaco
2025-10-20 11:28 ` [RESEND PATCH v13 7/9] cgroup/cpuset: Fail if isolated and nohz_full don't leave any housekeeping Gabriele Monaco
2025-10-20 11:28 ` [RESEND PATCH v13 8/9] cpumask: Add initialiser to use cleanup helpers Gabriele Monaco
2025-10-20 11:28 ` [RESEND PATCH v13 9/9] timers: Exclude isolated cpus from timer migration Gabriele Monaco
2025-10-30  2:56 ` [RESEND PATCH v13 0/9] " Waiman Long
2025-10-30 14:12   ` Frederic Weisbecker
     [not found]     ` <5457560d-f48a-4a99-8756-51b1017a6aab@redhat.com>
2025-10-30 16:09       ` Gabriele Monaco
2025-10-30 16:37         ` Waiman Long
2025-10-30 17:10           ` Frederic Weisbecker
2025-10-30 17:57             ` Waiman Long
2025-10-31 13:48               ` Frederic Weisbecker
2025-10-31 14:03                 ` Gabriele Monaco
2025-10-31 16:14                 ` Waiman Long
2025-10-30 17:08       ` 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=20251020112802.102451-2-gmonaco@redhat.com \
    --to=gmonaco@redhat.com \
    --cc=anna-maria@linutronix.de \
    --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