powerpc/pseries/mobility: handle premature return from H_JOIN
authorNathan Lynch <nathanl@linux.ibm.com>
Mon, 15 Mar 2021 08:00:45 +0000 (03:00 -0500)
committerMichael Ellerman <mpe@ellerman.id.au>
Mon, 22 Mar 2021 22:25:12 +0000 (09:25 +1100)
commit274cb1ca2e7ce02cab56f5f4c61a74aeb566f931
tree2d7560711667736ecb0664d10b44be597fdfcece
parente834df6cfc71d8e5ce2c27a0184145ea125c3f0f
powerpc/pseries/mobility: handle premature return from H_JOIN

The pseries join/suspend sequence in its current form was written with
the assumption that it was the only user of H_PROD and that it needn't
handle spurious successful returns from H_JOIN. That's wrong;
powerpc's paravirt spinlock code uses H_PROD, and CPUs entering
do_join() can be woken prematurely from H_JOIN with a status of
H_SUCCESS as a result. This causes all CPUs to exit the sequence
early, preventing suspend from occurring at all.

Add a 'done' boolean flag to the pseries_suspend_info struct, and have
the waking thread set it before waking the other threads. Threads
which receive H_SUCCESS from H_JOIN retry if the 'done' flag is still
unset.

Fixes: 9327dc0aeef3 ("powerpc/pseries/mobility: use stop_machine for join/suspend")
Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210315080045.460331-3-nathanl@linux.ibm.com
arch/powerpc/platforms/pseries/mobility.c