Commit 1018424a authored by Heiko Carstens's avatar Heiko Carstens Committed by Vasily Gorbik
Browse files

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: default avatarMete Durlu <meted@linux.ibm.com>
Reviewed-by: default avatarMete Durlu <meted@linux.ibm.com>
Acked-by: default avatarChristian Borntraeger <borntraeger@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
parent 991a2017
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4236,10 +4236,10 @@
	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.

+1 −0
Original line number Diff line number Diff line
@@ -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
+6 −0
Original line number Diff line number Diff line
@@ -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)
+1 −7
Original line number Diff line number Diff line
@@ -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;