Skip to content

Commit 1018424

Browse files
hcahcaVasily Gorbik
authored andcommitted
s390/smp: Add support for HOTPLUG_SMT
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>
1 parent 991a201 commit 1018424

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4236,10 +4236,10 @@
42364236
nosmp [SMP,EARLY] Tells an SMP kernel to act as a UP kernel,
42374237
and disable the IO APIC. legacy for "maxcpus=0".
42384238

4239-
nosmt [KNL,MIPS,PPC,S390,EARLY] Disable symmetric multithreading (SMT).
4239+
nosmt [KNL,MIPS,PPC,EARLY] Disable symmetric multithreading (SMT).
42404240
Equivalent to smt=1.
42414241

4242-
[KNL,X86,PPC] Disable symmetric multithreading (SMT).
4242+
[KNL,X86,PPC,S390] Disable symmetric multithreading (SMT).
42434243
nosmt=force: Force disable SMT, cannot be undone
42444244
via the sysfs control file.
42454245

arch/s390/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ config S390
239239
select HAVE_SYSCALL_TRACEPOINTS
240240
select HAVE_VIRT_CPU_ACCOUNTING
241241
select HAVE_VIRT_CPU_ACCOUNTING_IDLE
242+
select HOTPLUG_SMT
242243
select IOMMU_HELPER if PCI
243244
select IOMMU_SUPPORT if PCI
244245
select KASAN_VMALLOC if KASAN

arch/s390/include/asm/topology.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ static inline void topology_expect_change(void) { }
6161

6262
#endif /* CONFIG_SCHED_TOPOLOGY */
6363

64+
static inline bool topology_is_primary_thread(unsigned int cpu)
65+
{
66+
return smp_get_base_cpu(cpu) == cpu;
67+
}
68+
#define topology_is_primary_thread topology_is_primary_thread
69+
6470
#define POLARIZATION_UNKNOWN (-1)
6571
#define POLARIZATION_HRZ (0)
6672
#define POLARIZATION_VL (1)

arch/s390/kernel/smp.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,6 @@ __vector128 __initdata boot_cpu_vector_save_area[__NUM_VXRS];
9999
static unsigned int smp_max_threads __initdata = -1U;
100100
cpumask_t cpu_setup_mask;
101101

102-
static int __init early_nosmt(char *s)
103-
{
104-
smp_max_threads = 1;
105-
return 0;
106-
}
107-
early_param("nosmt", early_nosmt);
108-
109102
static int __init early_smt(char *s)
110103
{
111104
get_option(&s, &smp_max_threads);
@@ -808,6 +801,7 @@ void __init smp_detect_cpus(void)
808801
mtid = boot_core_type ? sclp.mtid : sclp.mtid_cp;
809802
mtid = (mtid < smp_max_threads) ? mtid : smp_max_threads - 1;
810803
pcpu_set_smt(mtid);
804+
cpu_smt_set_num_threads(smp_cpu_mtid + 1, smp_cpu_mtid + 1);
811805

812806
/* Print number of CPUs */
813807
c_cpus = s_cpus = 0;

0 commit comments

Comments
 (0)