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.

Merge tag 'smp-urgent-2023-09-02' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip

Pull CPU hotplug fix from Ingo Molnar:
"Fix a CPU hotplug related deadlock between the task which initiates
and controls a CPU hot-unplug operation vs. the CFS bandwidth timer"

* tag 'smp-urgent-2023-09-02' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
cpu/hotplug: Prevent self deadlock on CPU hot-unplug

+23 -1
+23 -1
kernel/cpu.c
··· 1487 1487 return ret; 1488 1488 } 1489 1489 1490 + struct cpu_down_work { 1491 + unsigned int cpu; 1492 + enum cpuhp_state target; 1493 + }; 1494 + 1495 + static long __cpu_down_maps_locked(void *arg) 1496 + { 1497 + struct cpu_down_work *work = arg; 1498 + 1499 + return _cpu_down(work->cpu, 0, work->target); 1500 + } 1501 + 1490 1502 static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target) 1491 1503 { 1504 + struct cpu_down_work work = { .cpu = cpu, .target = target, }; 1505 + 1492 1506 /* 1493 1507 * If the platform does not support hotplug, report it explicitly to 1494 1508 * differentiate it from a transient offlining failure. ··· 1511 1497 return -EOPNOTSUPP; 1512 1498 if (cpu_hotplug_disabled) 1513 1499 return -EBUSY; 1514 - return _cpu_down(cpu, 0, target); 1500 + 1501 + /* 1502 + * Ensure that the control task does not run on the to be offlined 1503 + * CPU to prevent a deadlock against cfs_b->period_timer. 1504 + */ 1505 + cpu = cpumask_any_but(cpu_online_mask, cpu); 1506 + if (cpu >= nr_cpu_ids) 1507 + return -EBUSY; 1508 + return work_on_cpu(cpu, __cpu_down_maps_locked, &work); 1515 1509 } 1516 1510 1517 1511 static int cpu_down(unsigned int cpu, enum cpuhp_state target)