aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/kernel/topology.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/s390/kernel/topology.c')
-rw-r--r--arch/s390/kernel/topology.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
index 632b13e10053..a947899dcba1 100644
--- a/arch/s390/kernel/topology.c
+++ b/arch/s390/kernel/topology.c
@@ -65,18 +65,21 @@ static int machine_has_topology_irq;
65static struct timer_list topology_timer; 65static struct timer_list topology_timer;
66static void set_topology_timer(void); 66static void set_topology_timer(void);
67static DECLARE_WORK(topology_work, topology_work_fn); 67static DECLARE_WORK(topology_work, topology_work_fn);
68/* topology_lock protects the core linked list */
69static DEFINE_SPINLOCK(topology_lock);
68 70
69cpumask_t cpu_core_map[NR_CPUS]; 71cpumask_t cpu_core_map[NR_CPUS];
70 72
71cpumask_t cpu_coregroup_map(unsigned int cpu) 73cpumask_t cpu_coregroup_map(unsigned int cpu)
72{ 74{
73 struct core_info *core = &core_info; 75 struct core_info *core = &core_info;
76 unsigned long flags;
74 cpumask_t mask; 77 cpumask_t mask;
75 78
76 cpus_clear(mask); 79 cpus_clear(mask);
77 if (!machine_has_topology) 80 if (!machine_has_topology)
78 return cpu_present_map; 81 return cpu_present_map;
79 mutex_lock(&smp_cpu_state_mutex); 82 spin_lock_irqsave(&topology_lock, flags);
80 while (core) { 83 while (core) {
81 if (cpu_isset(cpu, core->mask)) { 84 if (cpu_isset(cpu, core->mask)) {
82 mask = core->mask; 85 mask = core->mask;
@@ -84,7 +87,7 @@ cpumask_t cpu_coregroup_map(unsigned int cpu)
84 } 87 }
85 core = core->next; 88 core = core->next;
86 } 89 }
87 mutex_unlock(&smp_cpu_state_mutex); 90 spin_unlock_irqrestore(&topology_lock, flags);
88 if (cpus_empty(mask)) 91 if (cpus_empty(mask))
89 mask = cpumask_of_cpu(cpu); 92 mask = cpumask_of_cpu(cpu);
90 return mask; 93 return mask;
@@ -133,7 +136,7 @@ static void tl_to_cores(struct tl_info *info)
133 union tl_entry *tle, *end; 136 union tl_entry *tle, *end;
134 struct core_info *core = &core_info; 137 struct core_info *core = &core_info;
135 138
136 mutex_lock(&smp_cpu_state_mutex); 139 spin_lock_irq(&topology_lock);
137 clear_cores(); 140 clear_cores();
138 tle = info->tle; 141 tle = info->tle;
139 end = (union tl_entry *)((unsigned long)info + info->length); 142 end = (union tl_entry *)((unsigned long)info + info->length);
@@ -157,7 +160,7 @@ static void tl_to_cores(struct tl_info *info)
157 } 160 }
158 tle = next_tle(tle); 161 tle = next_tle(tle);
159 } 162 }
160 mutex_unlock(&smp_cpu_state_mutex); 163 spin_unlock_irq(&topology_lock);
161} 164}
162 165
163static void topology_update_polarization_simple(void) 166static void topology_update_polarization_simple(void)