s390/smp: disallow CPU hotplug of CPU 0
authorTobias Huschle <huschle@linux.ibm.com>
Wed, 16 Aug 2023 07:28:20 +0000 (09:28 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Tue, 19 Sep 2023 11:26:55 +0000 (13:26 +0200)
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
e59e74dc48a3 ("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>
arch/s390/kernel/smp.c

index c63be2efd68952aa754f011db97ad0a6e3e621de..e8284cec36e7ab110fd8491e7f8a36e1fc2f76af 100644 (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;