From: "tip-bot2 for Frederic Weisbecker" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Frederic Weisbecker <frederic@kernel.org>,
Thomas Gleixner <tglx@kernel.org>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: timers/core] timers/migration: Track CPUs in a hierarchy
Date: Wed, 06 May 2026 07:11:40 -0000 [thread overview]
Message-ID: <177805150083.424702.3916166576545919969.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20260423165354.95152-4-frederic@kernel.org>
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 3ba25488380fd76230442df366c464c6e1fd6485
Gitweb: https://git.kernel.org/tip/3ba25488380fd76230442df366c464c6e1fd6485
Author: Frederic Weisbecker <frederic@kernel.org>
AuthorDate: Thu, 23 Apr 2026 18:53:51 +02:00
Committer: Thomas Gleixner <tglx@kernel.org>
CommitterDate: Wed, 06 May 2026 08:33:06 +02:00
timers/migration: Track CPUs in a hierarchy
When a new root is created, the old root is connected to it and
propagates up its own assumed to be active state, since the hotplug
control CPU is itself active and part of the old root.
However with per-capacity hierarchies, this assumption won't be true
anymore because the hotplug control CPU calling the timer migration
prepare callback may not belong to the same hierarchy as the booting
CPU.
To solve this, track the available CPUs per hierarchies so that the
root connection can be offlined to safe CPUs.
Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Link: https://patch.msgid.link/20260423165354.95152-4-frederic@kernel.org
---
kernel/time/timer_migration.c | 24 ++++++++++++++++++------
kernel/time/timer_migration.h | 2 ++
2 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
index a8ec85f..a68b9c7 100644
--- a/kernel/time/timer_migration.c
+++ b/kernel/time/timer_migration.c
@@ -1916,17 +1916,23 @@ static struct tmigr_hierarchy *tmigr_get_hierarchy(void)
if (!hierarchy)
return ERR_PTR(-ENOMEM);
+ hierarchy->cpumask = kzalloc(cpumask_size(), GFP_KERNEL);
+ if (!hierarchy->cpumask)
+ goto err;
+
hierarchy->level_list = kzalloc_objs(struct list_head, tmigr_hierarchy_levels);
- if (!hierarchy->level_list) {
- kfree(hierarchy);
- hierarchy = NULL;
- return ERR_PTR(-ENOMEM);
- }
+ if (!hierarchy->level_list)
+ goto err;
for (int i = 0; i < tmigr_hierarchy_levels; i++)
INIT_LIST_HEAD(&hierarchy->level_list[i]);
return hierarchy;
+err:
+ kfree(hierarchy->cpumask);
+ kfree(hierarchy);
+ hierarchy = NULL;
+ return ERR_PTR(-ENOMEM);
}
static int tmigr_add_cpu(unsigned int cpu)
@@ -1946,8 +1952,11 @@ static int tmigr_add_cpu(unsigned int cpu)
ret = tmigr_setup_groups(hier, cpu, node, NULL, false);
+ if (ret < 0)
+ return ret;
+
/* Root has changed? Connect the old one to the new */
- if (ret >= 0 && old_root && old_root != hier->root) {
+ if (old_root && old_root != hier->root) {
/*
* The target CPU must never do the prepare work, except
* on early boot when the boot CPU is the target. Otherwise
@@ -1964,6 +1973,9 @@ static int tmigr_add_cpu(unsigned int cpu)
ret = tmigr_setup_groups(hier, -1, old_root->numa_node, old_root, true);
}
+ if (ret >= 0)
+ cpumask_set_cpu(cpu, hier->cpumask);
+
return ret;
}
diff --git a/kernel/time/timer_migration.h b/kernel/time/timer_migration.h
index 77df422..0cfbb8d 100644
--- a/kernel/time/timer_migration.h
+++ b/kernel/time/timer_migration.h
@@ -8,10 +8,12 @@
/**
* struct tmigr_hierarchy - a hierarchy associated to a given CPU capacity.
* @level_list: Per level lists of tmigr groups
+ * @cpumask: CPUs belonging to this hierarchy
* @root: The current root of the hierarchy
*/
struct tmigr_hierarchy {
struct list_head *level_list;
+ struct cpumask *cpumask;
struct tmigr_group *root;
};
next prev parent reply other threads:[~2026-05-06 7:11 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-23 16:53 [PATCH 0/6] timers/migration: Handle heterogenous CPU capacities Frederic Weisbecker
2026-04-23 16:53 ` [PATCH 1/6] timers/migration: Fix another hotplug activation race Frederic Weisbecker
2026-05-06 6:22 ` [tip: timers/urgent] " tip-bot2 for Frederic Weisbecker
2026-04-23 16:53 ` [PATCH 2/6] timers/migration: Abstract out hierarchy to prepare for CPU capacity awareness Frederic Weisbecker
2026-05-06 7:11 ` [tip: timers/core] " tip-bot2 for Frederic Weisbecker
2026-04-23 16:53 ` [PATCH 3/6] timers/migration: Track CPUs in a hierarchy Frederic Weisbecker
2026-05-06 7:11 ` tip-bot2 for Frederic Weisbecker [this message]
2026-04-23 16:53 ` [PATCH 4/6] timers/migration: Split per-capacity hierarchies Frederic Weisbecker
2026-05-06 7:11 ` [tip: timers/core] " tip-bot2 for Frederic Weisbecker
2026-04-23 16:53 ` [PATCH 5/6] timers/migration: Handle capacity in connect tracepoints Frederic Weisbecker
2026-05-06 7:11 ` [tip: timers/core] " tip-bot2 for Frederic Weisbecker
2026-04-23 16:53 ` [PATCH 6/6] scripts/timers: Add timer_migration_tree.py Frederic Weisbecker
2026-05-06 7:11 ` [tip: timers/core] " tip-bot2 for Frederic Weisbecker
2026-06-03 22:50 ` [PATCH 0/6] timers/migration: Handle heterogenous CPU capacities Christian Loehle
2026-06-04 13:36 ` Frederic Weisbecker
2026-06-05 10:10 ` Christian Loehle
2026-06-10 15:02 ` Frederic Weisbecker
2026-07-14 15:00 ` Qais Yousef
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=177805150083.424702.3916166576545919969.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=frederic@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=tglx@kernel.org \
--cc=x86@kernel.org \
/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®