Re: [tip: timers/urgent] timers/migration: Move hierarchy setup into cpuhotplug prepare callback
From: Borislav Petkov
Date: Wed Jul 24 2024 - 06:22:47 EST
On Mon, Jul 22, 2024 at 03:16:20PM +0200, Frederic Weisbecker wrote:
> diff --git a/kernel/time/timer_migration.c b/kernel/time/timer_migration.c
> index fae04950487f..8d57f7686bb0 100644
> --- a/kernel/time/timer_migration.c
> +++ b/kernel/time/timer_migration.c
> @@ -1673,6 +1673,15 @@ static int tmigr_setup_groups(unsigned int cpu, unsigned int node)
>
> lvllist = &tmigr_level_list[top];
> if (group->num_children == 1 && list_is_singular(lvllist)) {
> + /*
> + * The target CPU must never do the prepare work, except
> + * on early boot when the boot CPU is the target. Otherwise
> + * it may spuriously activate the old top level group inside
> + * the new one (nevertheless whether old top level group is
> + * active or not) and/or release an uninitialized childmask.
> + */
> + WARN_ON_ONCE(cpu == raw_smp_processor_id());
> +
> lvllist = &tmigr_level_list[top - 1];
> list_for_each_entry(child, lvllist, list) {
> if (child->parent)
> @@ -1705,14 +1714,6 @@ static int tmigr_cpu_prepare(unsigned int cpu)
> struct tmigr_cpu *tmc = per_cpu_ptr(&tmigr_cpu, cpu);
> int ret = 0;
>
> - /*
> - * The target CPU must never do the prepare work. Otherwise it may
> - * spuriously activate the old top level group inside the new one
> - * (nevertheless whether old top level group is active or not) and/or
> - * release an uninitialized childmask.
> - */
> - WARN_ON_ONCE(cpu == raw_smp_processor_id());
> -
> /* Not first online attempt? */
> if (tmc->tmgroup)
> return ret;
That fixes the issue as confirmed by Narasimhan.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette