mirror of
https://github.com/torvalds/linux.git
synced 2024-11-22 12:11:40 +00:00
Fix a CPU hotplug related deadlock between the task which initiates
and controls a CPU hot-unplug operation vs. the CFS bandwidth timer. Signed-off-by: Ingo Molnar <mingo@kernel.org> -----BEGIN PGP SIGNATURE----- iQJFBAABCgAvFiEEBpT5eoXrXCwVQwEKEnMQ0APhK1gFAmTzCnoRHG1pbmdvQGtl cm5lbC5vcmcACgkQEnMQ0APhK1h9gQ//fOQT0OrAUwhAdW7IZcQGETdSykxYqRXT OciNPVUirJOXJM7tG08OEUUAiRrbIALHBRkfNk/ycOWTfa2qsur3jyGgyi8cnKo9 NmdNltRMZ2UbKlJxzoeu1wIqWkmoLaYloVp3YWXgPClclNbBROCvXvEHnEr1iRtA trfEjNxEYgKeDkJROg0Av3RQTzLgZ3TqZ67mzJVZbCbz9i/IxicJa4PNuzrkw3c3 q42Btx+Ru1ikl/Jww0asX4iESFxuUk3Aw7DBX7slaLMrLcPMKsbO2D3npSxLFTCP TUdMKoIanVjl5+a2//kT8TkV+M1OKvczy6AYH0pV/yZLkAQqJmLphVsEI6rMIdp2 ep26hrjaLlhp3dTr8jNQ86BlxT6zqP1/+OpC4BbKFK2HLJj7sGKcb5W5WMdhB/Qh tA+CgVZXJDHkH2m2zD6o+SDm5JvbbHOLywfBBUSggHDDq3oOrxdjS2g8tgFwtnJ2 ZxjvJ4Ot3M26b44qkQbJeG42Q7ciLDrfaOZhlZ6bt30agU4EP3bg4dZAL24EoPLY zdom++puL+nUBr6EvzbboVxisuf0cvDbujmuFRQdntRRy8oHgiQVhb+b4EWh0oOc CKN06nyA9z5MzhAek3/GuxMYKEWM9/Dy6rDyqvaxfcbc9PIaxGfRxjgpKxrdRPOu rjGsQHZbTlo= =wM0O -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
23dfeae882
24
kernel/cpu.c
24
kernel/cpu.c
@ -1487,8 +1487,22 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
struct cpu_down_work {
|
||||
unsigned int cpu;
|
||||
enum cpuhp_state target;
|
||||
};
|
||||
|
||||
static long __cpu_down_maps_locked(void *arg)
|
||||
{
|
||||
struct cpu_down_work *work = arg;
|
||||
|
||||
return _cpu_down(work->cpu, 0, work->target);
|
||||
}
|
||||
|
||||
static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
|
||||
{
|
||||
struct cpu_down_work work = { .cpu = cpu, .target = target, };
|
||||
|
||||
/*
|
||||
* If the platform does not support hotplug, report it explicitly to
|
||||
* differentiate it from a transient offlining failure.
|
||||
@ -1497,7 +1511,15 @@ static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
|
||||
return -EOPNOTSUPP;
|
||||
if (cpu_hotplug_disabled)
|
||||
return -EBUSY;
|
||||
return _cpu_down(cpu, 0, target);
|
||||
|
||||
/*
|
||||
* Ensure that the control task does not run on the to be offlined
|
||||
* CPU to prevent a deadlock against cfs_b->period_timer.
|
||||
*/
|
||||
cpu = cpumask_any_but(cpu_online_mask, cpu);
|
||||
if (cpu >= nr_cpu_ids)
|
||||
return -EBUSY;
|
||||
return work_on_cpu(cpu, __cpu_down_maps_locked, &work);
|
||||
}
|
||||
|
||||
static int cpu_down(unsigned int cpu, enum cpuhp_state target)
|
||||
|
Loading…
Reference in New Issue
Block a user