Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10ad34bc authored by Martin Schwidefsky's avatar Martin Schwidefsky
Browse files

s390: add SMT support



The multi-threading facility is introduced with the z13 processor family.
This patch adds code to detect the multi-threading facility. With the
facility enabled each core will surface multiple hardware threads to the
system. Each hardware threads looks like a normal CPU to the operating
system with all its registers and properties.

The SCLP interface reports the SMT topology indirectly via the maximum
thread id. Each reported CPU in the result of a read-scp-information
is a core representing a number of hardware threads.

To reflect the reduced CPU capacity if two hardware threads run on a
single core the MT utilization counter set is used to normalize the
raw cputime obtained by the CPU timer deltas. This scaled cputime is
reported via the taskstats interface. The normal /proc/stat numbers
are based on the raw cputime and are not affected by the normalization.

Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 1f6b83e5
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -396,17 +396,26 @@ config HOTPLUG_CPU
	  can be controlled through /sys/devices/system/cpu/cpu#.
	  Say N if you want to disable CPU hotplug.

config SCHED_SMT
	def_bool n

config SCHED_MC
	def_bool n

config SCHED_BOOK
	def_bool n

config SCHED_TOPOLOGY
	def_bool y
	prompt "Book scheduler support"
	prompt "Topology scheduler support"
	depends on SMP
	select SCHED_SMT
	select SCHED_MC
	select SCHED_BOOK
	help
	  Book scheduler support improves the CPU scheduler's decision making
	  when dealing with machines that have several books.
	  Topology scheduler support improves the CPU scheduler's decision
	  making when dealing with machines that have multi-threading,
	  multiple cores or multiple books.

source kernel/Kconfig.preempt

+14 −0
Original line number Diff line number Diff line
@@ -189,6 +189,20 @@ static inline int ecctr(u64 ctr, u64 *val)
	return cc;
}

/* Store CPU counter multiple for the MT utilization counter set */
static inline int stcctm5(u64 num, u64 *val)
{
	typedef struct { u64 _[num]; } addrtype;
	int cc;

	asm volatile (
		"	.insn	rsy,0xeb0000000017,%2,5,%1\n"
		"	ipm	%0\n"
		"	srl	%0,28\n"
		: "=d" (cc), "=Q" (*(addrtype *) val)  : "d" (num) : "cc");
	return cc;
}

/* Query sampling information */
static inline int qsi(struct hws_qsi_info_block *info)
{
+2 −1
Original line number Diff line number Diff line
@@ -15,5 +15,6 @@ struct reset_call {

extern void register_reset_call(struct reset_call *reset);
extern void unregister_reset_call(struct reset_call *reset);
extern void s390_reset_system(void (*func)(void *), void *data);
extern void s390_reset_system(void (*fn_pre)(void),
			      void (*fn_post)(void *), void *data);
#endif /* _ASM_S390_RESET_H */
+4 −1
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ struct sclp_ipl_info {
};

struct sclp_cpu_entry {
	u8 address;
	u8 core_id;
	u8 reserved0[2];
	u8 : 3;
	u8 siif : 1;
@@ -51,6 +51,9 @@ int sclp_cpu_deconfigure(u8 cpu);
unsigned long long sclp_get_rnmax(void);
unsigned long long sclp_get_rzm(void);
unsigned int sclp_get_max_cpu(void);
unsigned int sclp_get_mtid(u8 cpu_type);
unsigned int sclp_get_mtid_max(void);
unsigned int sclp_get_mtid_prev(void);
int sclp_sdias_blk_count(void);
int sclp_sdias_copy(void *dest, int blk_num, int nr_blks);
int sclp_chp_configure(struct chp_id chpid);
+1 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
#define SIGP_SET_ARCHITECTURE	     18
#define SIGP_COND_EMERGENCY_SIGNAL   19
#define SIGP_SENSE_RUNNING	     21
#define SIGP_SET_MULTI_THREADING     22
#define SIGP_STORE_ADDITIONAL_STATUS 23

/* SIGP condition codes */
Loading