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.

cpu: Revert "cpu/hotplug: Prevent self deadlock on CPU hot-unplug"

1) The commit:

2b8272ff4a70 ("cpu/hotplug: Prevent self deadlock on CPU hot-unplug")

was added to fix an issue where the hotplug control task (BP) was
throttled between CPUHP_AP_IDLE_DEAD and CPUHP_HRTIMERS_PREPARE waiting
in the hrtimer blindspot for the bandwidth callback queued in the dead
CPU.

2) Later on, the commit:

38685e2a0476 ("cpu/hotplug: Don't offline the last non-isolated CPU")

plugged on the target selection for the workqueue offloaded CPU down
process to prevent from destroying the last CPU domain.

3) Finally:

5c0930ccaad5 ("hrtimers: Push pending hrtimers away from outgoing CPU earlier")

removed entirely the conditions for the race exposed and partially fixed
in 1). The offloading of the CPU down process to a workqueue on another
CPU then becomes unnecessary. But the last CPU belonging to scheduler
domains must still remain online.

Therefore revert the now obsolete commit
2b8272ff4a70b866106ae13c36be7ecbef5d5da2 and move the housekeeping check
under the cpu_hotplug_lock write held. Since HK_TYPE_DOMAIN will include
both isolcpus and cpuset isolated partition, the hotplug lock will
synchronize against concurrent cpuset partition updates.

Signed-off-by: Frederic Weisbecker <frederic@kernel.org>
Cc: Marco Crivellari <marco.crivellari@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Waiman Long <longman@redhat.com>

+11 -26
+11 -26
kernel/cpu.c
··· 1410 1410 1411 1411 cpus_write_lock(); 1412 1412 1413 + /* 1414 + * Keep at least one housekeeping cpu onlined to avoid generating 1415 + * an empty sched_domain span. 1416 + */ 1417 + if (cpumask_any_and(cpu_online_mask, 1418 + housekeeping_cpumask(HK_TYPE_DOMAIN)) >= nr_cpu_ids) { 1419 + ret = -EBUSY; 1420 + goto out; 1421 + } 1422 + 1413 1423 cpuhp_tasks_frozen = tasks_frozen; 1414 1424 1415 1425 prev_state = cpuhp_set_state(cpu, st, target); ··· 1466 1456 return ret; 1467 1457 } 1468 1458 1469 - struct cpu_down_work { 1470 - unsigned int cpu; 1471 - enum cpuhp_state target; 1472 - }; 1473 - 1474 - static long __cpu_down_maps_locked(void *arg) 1475 - { 1476 - struct cpu_down_work *work = arg; 1477 - 1478 - return _cpu_down(work->cpu, 0, work->target); 1479 - } 1480 - 1481 1459 static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target) 1482 1460 { 1483 - struct cpu_down_work work = { .cpu = cpu, .target = target, }; 1484 - 1485 1461 /* 1486 1462 * If the platform does not support hotplug, report it explicitly to 1487 1463 * differentiate it from a transient offlining failure. ··· 1476 1480 return -EOPNOTSUPP; 1477 1481 if (cpu_hotplug_disabled) 1478 1482 return -EBUSY; 1479 - 1480 - /* 1481 - * Ensure that the control task does not run on the to be offlined 1482 - * CPU to prevent a deadlock against cfs_b->period_timer. 1483 - * Also keep at least one housekeeping cpu onlined to avoid generating 1484 - * an empty sched_domain span. 1485 - */ 1486 - for_each_cpu_and(cpu, cpu_online_mask, housekeeping_cpumask(HK_TYPE_DOMAIN)) { 1487 - if (cpu != work.cpu) 1488 - return work_on_cpu(cpu, __cpu_down_maps_locked, &work); 1489 - } 1490 - return -EBUSY; 1483 + return _cpu_down(cpu, 0, target); 1491 1484 } 1492 1485 1493 1486 static int cpu_down(unsigned int cpu, enum cpuhp_state target)