]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
s390/smp: Add support for HOTPLUG_SMT
authorHeiko Carstens <hca@linux.ibm.com>
Thu, 27 Mar 2025 09:14:43 +0000 (10:14 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 31 Mar 2025 10:20:39 +0000 (12:20 +0200)
Add support for HOTPLUG_SMT. With this the s390 specific "nosmt" kernel
command line parameter handling is replaced with common code handling.

This means that just specifying "nosmt" still enables smt from an
architectural point of view, however only the primary (base) cpu can be set
online. Enabling smt during runtime via /sys/devices/system/cpu/smt/control
allows to set secondary cpus online. This way "nosmt" works like on other
architectures where enabling and disabling smt during runtime is possible.

If "nosmt=force" is specified smt is also still enabled from an
architectural point of view, but there is no way to set secondary cpus
online during runtime, also like on other architectures.

In order to disable smt from architectural point of view, which was
previously achieved with the s390 specific "nosmt" command line option,
"smt=1" can be used.

Tested-by: Mete Durlu <meted@linux.ibm.com>
Reviewed-by: Mete Durlu <meted@linux.ibm.com>
Acked-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Documentation/admin-guide/kernel-parameters.txt
arch/s390/Kconfig
arch/s390/include/asm/topology.h
arch/s390/kernel/smp.c

index 5e351ac52cca836bca2b5e68d08b21a0a62781f4..0d97f811d8b1fc78476ad4bc77545c79e3ad3278 100644 (file)
        nosmp           [SMP,EARLY] Tells an SMP kernel to act as a UP kernel,
                        and disable the IO APIC.  legacy for "maxcpus=0".
 
-       nosmt           [KNL,MIPS,PPC,S390,EARLY] Disable symmetric multithreading (SMT).
+       nosmt           [KNL,MIPS,PPC,EARLY] Disable symmetric multithreading (SMT).
                        Equivalent to smt=1.
 
-                       [KNL,X86,PPC] Disable symmetric multithreading (SMT).
+                       [KNL,X86,PPC,S390] Disable symmetric multithreading (SMT).
                        nosmt=force: Force disable SMT, cannot be undone
                                     via the sysfs control file.
 
index 6412e39a795d63de96ef02ff185273a9482a37b1..e220589dae1127f63f210d35d7950a6177be7af8 100644 (file)
@@ -239,6 +239,7 @@ config S390
        select HAVE_SYSCALL_TRACEPOINTS
        select HAVE_VIRT_CPU_ACCOUNTING
        select HAVE_VIRT_CPU_ACCOUNTING_IDLE
+       select HOTPLUG_SMT
        select IOMMU_HELPER             if PCI
        select IOMMU_SUPPORT            if PCI
        select KASAN_VMALLOC if KASAN
index cef06bffad8041a444ab8ff4b4a191028d951448..44110847342a1350ffd5324aa1d787dfb7f3d207 100644 (file)
@@ -61,6 +61,12 @@ static inline void topology_expect_change(void) { }
 
 #endif /* CONFIG_SCHED_TOPOLOGY */
 
+static inline bool topology_is_primary_thread(unsigned int cpu)
+{
+       return smp_get_base_cpu(cpu) == cpu;
+}
+#define topology_is_primary_thread topology_is_primary_thread
+
 #define POLARIZATION_UNKNOWN   (-1)
 #define POLARIZATION_HRZ       (0)
 #define POLARIZATION_VL                (1)
index f9908a41bfe8003a1baf6c29a77b4e583d6c45fe..63f41dfaba85d0e254eec7d7f781f724a4efe340 100644 (file)
@@ -99,13 +99,6 @@ __vector128 __initdata boot_cpu_vector_save_area[__NUM_VXRS];
 static unsigned int smp_max_threads __initdata = -1U;
 cpumask_t cpu_setup_mask;
 
-static int __init early_nosmt(char *s)
-{
-       smp_max_threads = 1;
-       return 0;
-}
-early_param("nosmt", early_nosmt);
-
 static int __init early_smt(char *s)
 {
        get_option(&s, &smp_max_threads);
@@ -808,6 +801,7 @@ void __init smp_detect_cpus(void)
        mtid = boot_core_type ? sclp.mtid : sclp.mtid_cp;
        mtid = (mtid < smp_max_threads) ? mtid : smp_max_threads - 1;
        pcpu_set_smt(mtid);
+       cpu_smt_set_num_threads(smp_cpu_mtid + 1, smp_cpu_mtid + 1);
 
        /* Print number of CPUs */
        c_cpus = s_cpus = 0;