Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://patch.msgid.link/20251024132536.39841-5-frederic@kernel.org

authored by

Frederic Weisbecker and committed by
Thomas Gleixner
3c8eb36e 5eb579df

+8
+8
kernel/time/timer_migration.c
··· 1703 1703 1704 1704 if (activate) { 1705 1705 struct tmigr_walk data; 1706 + union tmigr_state state; 1706 1707 1707 1708 /* 1708 1709 * To prevent inconsistent states, active children need to be active in ··· 1727 1726 * the new childmask and parent to subsequent walkers through this 1728 1727 * @child. Therefore propagate active state unconditionally. 1729 1728 */ 1729 + state.state = atomic_read(&start->migr_state); 1730 + WARN_ON_ONCE(!state.active); 1730 1731 WARN_ON_ONCE(!start->parent); 1731 1732 data.childmask = start->groupmask; 1732 1733 __walk_groups_from(tmigr_active_up, &data, start, start->parent); ··· 1771 1768 * active or not) and/or release an uninitialized childmask. 1772 1769 */ 1773 1770 WARN_ON_ONCE(cpu == raw_smp_processor_id()); 1771 + /* 1772 + * The (likely) current CPU is expected to be online in the hierarchy, 1773 + * otherwise the old root may not be active as expected. 1774 + */ 1775 + WARN_ON_ONCE(!per_cpu_ptr(&tmigr_cpu, raw_smp_processor_id())->online); 1774 1776 ret = tmigr_setup_groups(-1, old_root->numa_node, old_root, true); 1775 1777 } 1776 1778