[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <176202608401.2601451.14363274452117247141.tip-bot2@tip-bot2>
Date: Sat, 01 Nov 2025 19:41:24 -0000
From: "tip-bot2 for Frederic Weisbecker" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Frederic Weisbecker <frederic@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] timers/migration: Assert that hotplug preparing
CPU is part of stable active hierarchy
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 3c8eb36e2a46786d50dbef417ef782ff37b372ca
Gitweb: https://git.kernel.org/tip/3c8eb36e2a46786d50dbef417ef782ff37b372ca
Author: Frederic Weisbecker <frederic@...nel.org>
AuthorDate: Fri, 24 Oct 2025 15:25:34 +02:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Sat, 01 Nov 2025 20:38:25 +01:00
timers/migration: Assert that hotplug preparing CPU is part of stable active hierarchy
The CPU doing the prepare work for a remote target must be online from
the tree point of view and its hierarchy must be active, otherwise
propagating its active state up to the new root branch would be either
incorrect or racy.
Assert those conditions with more sanity checks.
Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Link: https://patch.msgid.link/20251024132536.39841-5-frederic@kernel.org
---
kernel/time/timer_migration.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index 49635a2..bddd816 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1703,6 +1703,7 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node,
if (activate) {
struct tmigr_walk data;
+ union tmigr_state state;
/*
* To prevent inconsistent states, active children need to be active in
@@ -1726,6 +1727,8 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node,
* the new childmask and parent to subsequent walkers through this
* @child. Therefore propagate active state unconditionally.
*/
+ state.state = atomic_read(&start->migr_state);
+ WARN_ON_ONCE(!state.active);
WARN_ON_ONCE(!start->parent);
data.childmask = start->groupmask;
__walk_groups_from(tmigr_active_up, &data, start, start->parent);
@@ -1768,6 +1771,11 @@ static int tmigr_add_cpu(unsigned int cpu)
* active or not) and/or release an uninitialized childmask.
*/
WARN_ON_ONCE(cpu == raw_smp_processor_id());
+ /*
+ * The (likely) current CPU is expected to be online in the hierarchy,
+ * otherwise the old root may not be active as expected.
+ */
+ WARN_ON_ONCE(!per_cpu_ptr(&tmigr_cpu, raw_smp_processor_id())->online);
ret = tmigr_setup_groups(-1, old_root->numa_node, old_root, true);
}
Powered by blists - more mailing lists