s390/smp: disallow CPU hotplug of CPU 0

On s390, CPU 0 has special properties in comparison to other CPUs, as it
cannot be deconfigured for example. Therefore, allowing to hotplug CPU 0
introduces additional complexity when handling these properties.
Disallowing to hotplug CPU 0 allows to remove such complexities.

This follows x86 which also prevents offlining of CPU0 since commit
e59e74dc48 ("x86/topology: Remove CPU0 hotplug option").

[hca@linux.ibm.com: changed commit message]
Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Tobias Huschle <huschle@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Tobias Huschle 2023-08-16 09:28:20 +02:00 committed by Vasily Gorbik
parent 4a1725281f
commit 496bb034f4

View File

@ -1076,11 +1076,9 @@ static ssize_t cpu_configure_store(struct device *dev,
cpus_read_lock();
mutex_lock(&smp_cpu_state_mutex);
rc = -EBUSY;
/* disallow configuration changes of online cpus and cpu 0 */
/* disallow configuration changes of online cpus */
cpu = dev->id;
cpu = smp_get_base_cpu(cpu);
if (cpu == 0)
goto out;
for (i = 0; i <= smp_cpu_mtid; i++)
if (cpu_online(cpu + i))
goto out;
@ -1180,7 +1178,7 @@ static int smp_add_present_cpu(int cpu)
return -ENOMEM;
per_cpu(cpu_device, cpu) = c;
s = &c->dev;
c->hotpluggable = 1;
c->hotpluggable = !!cpu;
rc = register_cpu(c, cpu);
if (rc)
goto out;