On 2/16/26 6:27 PM, Shrikanth Hegde wrote:
*/
if (ctrlval == CPU_SMT_ENABLED && cpu_smt_thread_allowed(cpu))
continue;
- ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE);
If you see comment in cpu_down_maps_locked, It says.
* Ensure that the control task does not run on the to be offlined
* CPU to prevent a deadlock against cfs_b->period_timer.
* Also keep at least one housekeeping cpu onlined to avoid
generating
* an empty sched_domain span
Now, instead of running on the online_CPU you are now doing the _cpu_down
functionality in the cpu which is going offline.
How are you preventing that deadlock?
Ok. I should have looked at updated code. My bad.
This is no longer true after below commit.
de715325cc47 cpu: Revert "cpu/hotplug: Prevent self deadlock on CPU hot-unplug"
+ ret = cpu_down_locked(cpu, 0, CPUHP_OFFLINE);
if (ret)
break;
/*
@@ -2688,6 +2714,9 @@ int cpuhp_smt_disable(enum cpuhp_smt_control
ctrlval)
}
if (!ret)
cpu_smt_control = ctrlval;
+ cpus_write_unlock();
+ arch_smt_update();
+out:
cpu_maps_update_done();
return ret;
}
@@ -2705,6 +2734,8 @@ int cpuhp_smt_enable(void)
int cpu, ret = 0;
cpu_maps_update_begin();
+ /* Hold cpus_write_lock() for entire batch operation. */
+ cpus_write_lock();
cpu_smt_control = CPU_SMT_ENABLED;
for_each_present_cpu(cpu) {
/* Skip online CPUs and CPUs on offline nodes */
@@ -2712,12 +2743,14 @@ int cpuhp_smt_enable(void)
continue;
if (!cpu_smt_thread_allowed(cpu) || !
topology_is_core_online(cpu))
continue;
- ret = _cpu_up(cpu, 0, CPUHP_ONLINE);
+ ret = cpu_up_locked(cpu, 0, CPUHP_ONLINE);
if (ret)
break;
/* See comment in cpuhp_smt_disable() */
cpuhp_online_cpu_device(cpu);
}
+ cpus_write_unlock();
+ arch_smt_update();
cpu_maps_update_done();
return ret;
}