aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2010-10-25 10:10:54 -0400
committerMartin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com>2010-10-25 10:10:21 -0400
commit96f4a70d8eb4d746b19d5b5510407c8ff0d00340 (patch)
treec3e9ac41093211cb25c1c963707a159050f81edc
parentc30f91b6a264aef9ffb05e13931514c2a988c495 (diff)
[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>
-rw-r--r--arch/s390/include/asm/topology.h2
-rw-r--r--arch/s390/kernel/sysinfo.c34
-rw-r--r--arch/s390/kernel/topology.c3
3 files changed, 36 insertions, 3 deletions
diff --git a/arch/s390/include/asm/topology.h b/arch/s390/include/asm/topology.h
index 051107a2c5e2..c5338834ddbd 100644
--- a/arch/s390/include/asm/topology.h
+++ b/arch/s390/include/asm/topology.h
@@ -2,6 +2,7 @@
2#define _ASM_S390_TOPOLOGY_H 2#define _ASM_S390_TOPOLOGY_H
3 3
4#include <linux/cpumask.h> 4#include <linux/cpumask.h>
5#include <asm/sysinfo.h>
5 6
6extern unsigned char cpu_core_id[NR_CPUS]; 7extern unsigned char cpu_core_id[NR_CPUS];
7extern cpumask_t cpu_core_map[NR_CPUS]; 8extern cpumask_t cpu_core_map[NR_CPUS];
@@ -32,6 +33,7 @@ static inline const struct cpumask *cpu_book_mask(unsigned int cpu)
32 33
33int topology_set_cpu_management(int fc); 34int topology_set_cpu_management(int fc);
34void topology_schedule_update(void); 35void topology_schedule_update(void);
36void store_topology(struct sysinfo_15_1_x *info);
35 37
36#define POLARIZATION_UNKNWN (-1) 38#define POLARIZATION_UNKNWN (-1)
37#define POLARIZATION_HRZ (0) 39#define POLARIZATION_HRZ (0)
diff --git a/arch/s390/kernel/sysinfo.c b/arch/s390/kernel/sysinfo.c
index a91274b4eb8f..f04d93aa48ec 100644
--- a/arch/s390/kernel/sysinfo.c
+++ b/arch/s390/kernel/sysinfo.c
@@ -15,6 +15,7 @@
15#include <asm/ebcdic.h> 15#include <asm/ebcdic.h>
16#include <asm/sysinfo.h> 16#include <asm/sysinfo.h>
17#include <asm/cpcmd.h> 17#include <asm/cpcmd.h>
18#include <asm/topology.h>
18 19
19/* Sigh, math-emu. Don't ask. */ 20/* Sigh, math-emu. Don't ask. */
20#include <asm/sfp-util.h> 21#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)
84 return len; 85 return len;
85} 86}
86 87
88static int stsi_15_1_x(struct sysinfo_15_1_x *info, char *page, int len)
89{
90 static int max_mnest;
91 int i, rc;
92
93 len += sprintf(page + len, "\n");
94 if (!MACHINE_HAS_TOPOLOGY)
95 return len;
96 if (max_mnest) {
97 stsi(info, 15, 1, max_mnest);
98 } else {
99 for (max_mnest = 6; max_mnest > 1; max_mnest--) {
100 rc = stsi(info, 15, 1, max_mnest);
101 if (rc != -ENOSYS)
102 break;
103 }
104 }
105 len += sprintf(page + len, "CPU Topology HW: ");
106 for (i = 0; i < TOPOLOGY_NR_MAG; i++)
107 len += sprintf(page + len, " %d", info->mag[i]);
108 len += sprintf(page + len, "\n");
109 store_topology(info);
110 len += sprintf(page + len, "CPU Topology SW: ");
111 for (i = 0; i < TOPOLOGY_NR_MAG; i++)
112 len += sprintf(page + len, " %d", info->mag[i]);
113 len += sprintf(page + len, "\n");
114 return len;
115}
116
87static int stsi_1_2_2(struct sysinfo_1_2_2 *info, char *page, int len) 117static int stsi_1_2_2(struct sysinfo_1_2_2 *info, char *page, int len)
88{ 118{
89 struct sysinfo_1_2_2_extension *ext; 119 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)
94 ext = (struct sysinfo_1_2_2_extension *) 124 ext = (struct sysinfo_1_2_2_extension *)
95 ((unsigned long) info + info->acc_offset); 125 ((unsigned long) info + info->acc_offset);
96 126
97 len += sprintf(page + len, "\n");
98 len += sprintf(page + len, "CPUs Total: %d\n", 127 len += sprintf(page + len, "CPUs Total: %d\n",
99 info->cpus_total); 128 info->cpus_total);
100 len += sprintf(page + len, "CPUs Configured: %d\n", 129 len += sprintf(page + len, "CPUs Configured: %d\n",
@@ -224,6 +253,9 @@ static int proc_read_sysinfo(char *page, char **start,
224 len = stsi_1_1_1((struct sysinfo_1_1_1 *) info, page, len); 253 len = stsi_1_1_1((struct sysinfo_1_1_1 *) info, page, len);
225 254
226 if (level >= 1) 255 if (level >= 1)
256 len = stsi_15_1_x((struct sysinfo_15_1_x *) info, page, len);
257
258 if (level >= 1)
227 len = stsi_1_2_2((struct sysinfo_1_2_2 *) info, page, len); 259 len = stsi_1_2_2((struct sysinfo_1_2_2 *) info, page, len);
228 260
229 if (level >= 2) 261 if (level >= 2)
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index ffea01e63218..a9dee9048ee5 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -18,7 +18,6 @@
18#include <linux/cpuset.h> 18#include <linux/cpuset.h>
19#include <asm/delay.h> 19#include <asm/delay.h>
20#include <asm/s390_ext.h> 20#include <asm/s390_ext.h>
21#include <asm/sysinfo.h>
22 21
23#define PTF_HORIZONTAL (0UL) 22#define PTF_HORIZONTAL (0UL)
24#define PTF_VERTICAL (1UL) 23#define PTF_VERTICAL (1UL)
@@ -215,7 +214,7 @@ static void update_cpu_core_map(void)
215 spin_unlock_irqrestore(&topology_lock, flags); 214 spin_unlock_irqrestore(&topology_lock, flags);
216} 215}
217 216
218static void store_topology(struct tl_info *info) 217void store_topology(struct sysinfo_15_1_x *info)
219{ 218{
220#ifdef CONFIG_SCHED_BOOK 219#ifdef CONFIG_SCHED_BOOK
221 int rc; 220 int rc;