[patch v3 28/36] cpu/hotplug: Reset task stack state in _cpu_up()
From: Thomas Gleixner
Date: Mon May 08 2023 - 15:45:42 EST
From: David Woodhouse <dwmw@xxxxxxxxxxxx>
Commit dce1ca0525bf ("sched/scs: Reset task stack state in bringup_cpu()")
ensured that the shadow call stack and KASAN poisoning were removed from
a CPU's stack each time that CPU is brought up, not just once.
This is not incorrect. However, with parallel bringup the idle thread setup
will happen at a different step. As a consequence the cleanup in
bringup_cpu() would be too late.
Move the SCS/KASAN cleanup to the generic _cpu_up() function instead,
which already ensures that the new CPU's stack is available, purely to
allow for early failure. This occurs when the CPU to be brought up is
in the CPUHP_OFFLINE state, which should correctly do the cleanup any
time the CPU has been taken down to the point where such is needed.
Signed-off-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
Tested-by: Mark Rutland <mark.rutland@xxxxxxx>
Reviewed-by: Mark Rutland <mark.rutland@xxxxxxx>
Tested-by: Michael Kelley <mikelley@xxxxxxxxxxxxx>
kernel/cpu.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
@@ -771,12 +771,6 @@ static int bringup_cpu(unsigned int cpu)
- * Reset stale stack state from the last time this CPU was online.
* Some architectures have to walk the irq descriptors to
* setup the vector space for the cpu which comes online.
* Prevent irq alloc/free across the bringup.
@@ -1583,6 +1577,12 @@ static int _cpu_up(unsigned int cpu, int
ret = PTR_ERR(idle);
+ * Reset stale stack state from the last time this CPU was online.
cpuhp_tasks_frozen = tasks_frozen;