s390/smp: Reflect (de)configured CPUs to cpu_enabled_mask

On s390, CPUs can be in a state where it is not possible to hotplug
them online before certain prequisite steps. For example the CPUs which
get introduced during runtime of a system can posses a "deconfigured"
state which prevents them from being hotplugged online before they get
configured. Another case is when users set the configured state of CPUs
themselves via "chcpu" or sysfs attributes.

On s390 available CPUs are being registered as new devices via
smp_add_core() either during boot or after a CPU rescan (for newly added
CPUs during runtime). Registered CPUs are marked as enabled without
considering the configure states. Add necessary checks to smp_add_core()
and userspace configure attribute handler. Reflect the configured CPUs
to cpu_enabled_mask to correctly represent which CPUs can be hotplugged
online.

Signed-off-by: Mete Durlu <meted@linux.ibm.com>
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
This commit is contained in:
Mete Durlu
2026-07-23 15:36:43 +02:00
committed by Vasily Gorbik
parent 753b3873ce
commit faa39c2eca

View File

@@ -1038,6 +1038,7 @@ static ssize_t cpu_configure_store(struct device *dev,
per_cpu(pcpu_devices, cpu + i).state = CPU_STATE_STANDBY;
smp_cpu_set_polarization(cpu + i,
POLARIZATION_UNKNOWN);
set_cpu_enabled(cpu + i, false);
}
topology_expect_change();
break;
@@ -1053,6 +1054,7 @@ static ssize_t cpu_configure_store(struct device *dev,
per_cpu(pcpu_devices, cpu + i).state = CPU_STATE_CONFIGURED;
smp_cpu_set_polarization(cpu + i,
POLARIZATION_UNKNOWN);
set_cpu_enabled(cpu + i, true);
}
topology_expect_change();
break;
@@ -1090,6 +1092,7 @@ bool arch_cpu_is_hotpluggable(int cpu)
int arch_register_cpu(int cpu)
{
struct pcpu *pcpu = per_cpu_ptr(&pcpu_devices, cpu);
struct cpu *c = per_cpu_ptr(&cpu_devices, cpu);
int rc;
@@ -1103,6 +1106,8 @@ int arch_register_cpu(int cpu)
rc = topology_cpu_init(c);
if (rc)
goto out_topology;
if (pcpu->state != CPU_STATE_CONFIGURED)
set_cpu_enabled(cpu, false);
return 0;
out_topology: