s390/topology: fix topology information when calling cpu hotplug notifiers
authorSven Schnelle <svens@linux.ibm.com>
Fri, 27 Aug 2021 18:21:05 +0000 (20:21 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:42:21 +0000 (13:42 +0200)
commit27cd75f410fd45fc2a14fc7fd07c8933137bf12e
tree3ffad17daacbd1424c6c28682d5620b3c8849367
parent4fa17a055142440d25f46eaee1dca0e33f124452
s390/topology: fix topology information when calling cpu hotplug notifiers

commit a052096bdd6809eeab809202726634d1ac975aa1 upstream.

The cpu hotplug notifiers are called without updating the core/thread
masks when a new CPU is added. This causes problems with code setting
up data structures in a cpu hotplug notifier, and relying on that later
in normal code.

This caused a crash in the new core scheduling code (SCHED_CORE),
where rq->core was set up in a notifier depending on cpu masks.

To fix this, add a cpu_setup_mask which is used in update_cpu_masks()
instead of the cpu_online_mask to determine whether the cpu masks should
be set for a certain cpu. Also move update_cpu_masks() to update the
masks before calling notify_cpu_starting() so that the notifiers are
seeing the updated masks.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Cc: <stable@vger.kernel.org>
[hca@linux.ibm.com: get rid of cpu_online_mask handling]
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/s390/include/asm/smp.h
arch/s390/kernel/smp.c
arch/s390/kernel/topology.c