mirror of https://gitee.com/openkylin/linux.git
[S390] topology: export cpu topology via proc/sysinfo
Export the cpu configuration topology via sysinfo. Two new lines are introduced: CPU Topology HW: 0 0 0 4 6 4 CPU Topology SW: 0 0 0 0 4 24 The HW line describes the cpu topology nesting levels when the maximum nesting level is used to get the corresponding SYSIB. The SW line describes what Linux is actually using. In this case it supports only two levels (CONFIG_SCHED_BOOK off) and therefore the hardware folded the two lower levels in the SYSIB response block. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
parent
c30f91b6a2
commit
96f4a70d8e
|
@ -2,6 +2,7 @@
|
|||
#define _ASM_S390_TOPOLOGY_H
|
||||
|
||||
#include <linux/cpumask.h>
|
||||
#include <asm/sysinfo.h>
|
||||
|
||||
extern unsigned char cpu_core_id[NR_CPUS];
|
||||
extern cpumask_t cpu_core_map[NR_CPUS];
|
||||
|
@ -32,6 +33,7 @@ static inline const struct cpumask *cpu_book_mask(unsigned int cpu)
|
|||
|
||||
int topology_set_cpu_management(int fc);
|
||||
void topology_schedule_update(void);
|
||||
void store_topology(struct sysinfo_15_1_x *info);
|
||||
|
||||
#define POLARIZATION_UNKNWN (-1)
|
||||
#define POLARIZATION_HRZ (0)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include <asm/ebcdic.h>
|
||||
#include <asm/sysinfo.h>
|
||||
#include <asm/cpcmd.h>
|
||||
#include <asm/topology.h>
|
||||
|
||||
/* Sigh, math-emu. Don't ask. */
|
||||
#include <asm/sfp-util.h>
|
||||
|
@ -84,6 +85,35 @@ static int stsi_1_1_1(struct sysinfo_1_1_1 *info, char *page, int len)
|
|||
return len;
|
||||
}
|
||||
|
||||
static int stsi_15_1_x(struct sysinfo_15_1_x *info, char *page, int len)
|
||||
{
|
||||
static int max_mnest;
|
||||
int i, rc;
|
||||
|
||||
len += sprintf(page + len, "\n");
|
||||
if (!MACHINE_HAS_TOPOLOGY)
|
||||
return len;
|
||||
if (max_mnest) {
|
||||
stsi(info, 15, 1, max_mnest);
|
||||
} else {
|
||||
for (max_mnest = 6; max_mnest > 1; max_mnest--) {
|
||||
rc = stsi(info, 15, 1, max_mnest);
|
||||
if (rc != -ENOSYS)
|
||||
break;
|
||||
}
|
||||
}
|
||||
len += sprintf(page + len, "CPU Topology HW: ");
|
||||
for (i = 0; i < TOPOLOGY_NR_MAG; i++)
|
||||
len += sprintf(page + len, " %d", info->mag[i]);
|
||||
len += sprintf(page + len, "\n");
|
||||
store_topology(info);
|
||||
len += sprintf(page + len, "CPU Topology SW: ");
|
||||
for (i = 0; i < TOPOLOGY_NR_MAG; i++)
|
||||
len += sprintf(page + len, " %d", info->mag[i]);
|
||||
len += sprintf(page + len, "\n");
|
||||
return len;
|
||||
}
|
||||
|
||||
static int stsi_1_2_2(struct sysinfo_1_2_2 *info, char *page, int len)
|
||||
{
|
||||
struct sysinfo_1_2_2_extension *ext;
|
||||
|
@ -94,7 +124,6 @@ static int stsi_1_2_2(struct sysinfo_1_2_2 *info, char *page, int len)
|
|||
ext = (struct sysinfo_1_2_2_extension *)
|
||||
((unsigned long) info + info->acc_offset);
|
||||
|
||||
len += sprintf(page + len, "\n");
|
||||
len += sprintf(page + len, "CPUs Total: %d\n",
|
||||
info->cpus_total);
|
||||
len += sprintf(page + len, "CPUs Configured: %d\n",
|
||||
|
@ -223,6 +252,9 @@ static int proc_read_sysinfo(char *page, char **start,
|
|||
if (level >= 1)
|
||||
len = stsi_1_1_1((struct sysinfo_1_1_1 *) info, page, len);
|
||||
|
||||
if (level >= 1)
|
||||
len = stsi_15_1_x((struct sysinfo_15_1_x *) info, page, len);
|
||||
|
||||
if (level >= 1)
|
||||
len = stsi_1_2_2((struct sysinfo_1_2_2 *) info, page, len);
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include <linux/cpuset.h>
|
||||
#include <asm/delay.h>
|
||||
#include <asm/s390_ext.h>
|
||||
#include <asm/sysinfo.h>
|
||||
|
||||
#define PTF_HORIZONTAL (0UL)
|
||||
#define PTF_VERTICAL (1UL)
|
||||
|
@ -215,7 +214,7 @@ static void update_cpu_core_map(void)
|
|||
spin_unlock_irqrestore(&topology_lock, flags);
|
||||
}
|
||||
|
||||
static void store_topology(struct tl_info *info)
|
||||
void store_topology(struct sysinfo_15_1_x *info)
|
||||
{
|
||||
#ifdef CONFIG_SCHED_BOOK
|
||||
int rc;
|
||||
|
|
Loading…
Reference in New Issue