Thomas Gleixner <t...@linutronix.de> writes: > Init task invokes smp_ops->setup_cpu() from smp_cpus_done(). Init task can > run on any online CPU at this point, but the setup_cpu() callback requires > to be invoked on the boot CPU. This is achieved by temporarily setting the > affinity of the calling user space thread to the requested CPU and reset it > to the original affinity afterwards. > > That's racy vs. CPU hotplug and concurrent affinity settings for that > thread resulting in code executing on the wrong CPU and overwriting the > new affinity setting. > > That's actually not a problem in this context as neither CPU hotplug nor > affinity settings can happen, but the access to task_struct::cpus_allowed > is about to restricted. > > Replace it with a call to work_on_cpu_safe() which achieves the same result. > > Signed-off-by: Thomas Gleixner <t...@linutronix.de> > Cc: Benjamin Herrenschmidt <b...@kernel.crashing.org> > Cc: Paul Mackerras <pau...@samba.org> > Cc: Michael Ellerman <m...@ellerman.id.au> > Cc: linuxppc-dev@lists.ozlabs.org > --- > arch/powerpc/kernel/smp.c | 26 +++++++++++--------------- > 1 file changed, 11 insertions(+), 15 deletions(-)
LGTM. Acked-by: Michael Ellerman <m...@ellerman.id.au> (powerpc) cheers