aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHeiko Carstens <heiko.carstens@de.ibm.com>2015-03-18 08:22:00 -0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2015-04-13 04:46:16 -0400
commit77bb36e57bbe5586bea29b67ba7f87cfe03610a0 (patch)
tree585024117ef4acc9a5f5a5c6de5032620e7c39d5
parent1a327ffd3d6a79ed85d53b683c185196060ac3b3 (diff)
s390/cacheinfo: add missing facility check
Git commit d97d929f06d0 ("s390: move cacheinfo sysfs to generic cacheinfo infrastructure") removed the general-instructions-extension availability check before the ecag instruction is executed. Without this check this may lead to crashes on machines without this facility. Therefore add the check again where needed. Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
-rw-r--r--arch/s390/kernel/cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/s390/kernel/cache.c b/arch/s390/kernel/cache.c
index 0969d113b3d6..bff5e3b6d822 100644
--- a/arch/s390/kernel/cache.c
+++ b/arch/s390/kernel/cache.c
@@ -70,6 +70,8 @@ void show_cacheinfo(struct seq_file *m)
70 struct cacheinfo *cache; 70 struct cacheinfo *cache;
71 int idx; 71 int idx;
72 72
73 if (!test_facility(34))
74 return;
73 get_online_cpus(); 75 get_online_cpus();
74 this_cpu_ci = get_cpu_cacheinfo(cpumask_any(cpu_online_mask)); 76 this_cpu_ci = get_cpu_cacheinfo(cpumask_any(cpu_online_mask));
75 for (idx = 0; idx < this_cpu_ci->num_leaves; idx++) { 77 for (idx = 0; idx < this_cpu_ci->num_leaves; idx++) {
@@ -159,6 +161,8 @@ int populate_cache_leaves(unsigned int cpu)
159 union cache_topology ct; 161 union cache_topology ct;
160 enum cache_type ctype; 162 enum cache_type ctype;
161 163
164 if (!test_facility(34))
165 return -EOPNOTSUPP;
162 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0); 166 ct.raw = ecag(EXTRACT_TOPOLOGY, 0, 0);
163 for (idx = 0, level = 0; level < this_cpu_ci->num_levels && 167 for (idx = 0, level = 0; level < this_cpu_ci->num_levels &&
164 idx < this_cpu_ci->num_leaves; idx++, level++) { 168 idx < this_cpu_ci->num_leaves; idx++, level++) {