aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorVincent Guittot <vincent.guittot@linaro.org>2012-07-10 09:11:11 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2012-07-12 15:38:11 -0400
commitcb75dacb39494164e6b1f7aa747fb639bf18584c (patch)
tree70466093e26f84019530bdce0a6b5fc45103072c /arch
parent130d9aabf997bd8449ff4e877fe3c42df066805e (diff)
ARM: 7462/1: topology: factorize the update of sibling masks
This factorization has also been proposed in another patch that has not been merged yet: http://lists.infradead.org/pipermail/linux-arm-kernel/2012-January/080873.html So, this patch could be dropped depending of the state of the other one. Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com> Signed-off-by: Vincent Guittot <vincent.guittot@linaro.org> Reviewed-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/kernel/topology.c48
1 files changed, 27 insertions, 21 deletions
diff --git a/arch/arm/kernel/topology.c b/arch/arm/kernel/topology.c
index 51f23b3ed0a6..eb5fc8132c02 100644
--- a/arch/arm/kernel/topology.c
+++ b/arch/arm/kernel/topology.c
@@ -82,6 +82,32 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
82 return &cpu_topology[cpu].core_sibling; 82 return &cpu_topology[cpu].core_sibling;
83} 83}
84 84
85void update_siblings_masks(unsigned int cpuid)
86{
87 struct cputopo_arm *cpu_topo, *cpuid_topo = &cpu_topology[cpuid];
88 int cpu;
89
90 /* update core and thread sibling masks */
91 for_each_possible_cpu(cpu) {
92 cpu_topo = &cpu_topology[cpu];
93
94 if (cpuid_topo->socket_id != cpu_topo->socket_id)
95 continue;
96
97 cpumask_set_cpu(cpuid, &cpu_topo->core_sibling);
98 if (cpu != cpuid)
99 cpumask_set_cpu(cpu, &cpuid_topo->core_sibling);
100
101 if (cpuid_topo->core_id != cpu_topo->core_id)
102 continue;
103
104 cpumask_set_cpu(cpuid, &cpu_topo->thread_sibling);
105 if (cpu != cpuid)
106 cpumask_set_cpu(cpu, &cpuid_topo->thread_sibling);
107 }
108 smp_wmb();
109}
110
85/* 111/*
86 * store_cpu_topology is called at boot when only one cpu is running 112 * store_cpu_topology is called at boot when only one cpu is running
87 * and with the mutex cpu_hotplug.lock locked, when several cpus have booted, 113 * and with the mutex cpu_hotplug.lock locked, when several cpus have booted,
@@ -91,7 +117,6 @@ void store_cpu_topology(unsigned int cpuid)
91{ 117{
92 struct cputopo_arm *cpuid_topo = &cpu_topology[cpuid]; 118 struct cputopo_arm *cpuid_topo = &cpu_topology[cpuid];
93 unsigned int mpidr; 119 unsigned int mpidr;
94 unsigned int cpu;
95 120
96 /* If the cpu topology has been already set, just return */ 121 /* If the cpu topology has been already set, just return */
97 if (cpuid_topo->core_id != -1) 122 if (cpuid_topo->core_id != -1)
@@ -133,26 +158,7 @@ void store_cpu_topology(unsigned int cpuid)
133 cpuid_topo->socket_id = -1; 158 cpuid_topo->socket_id = -1;
134 } 159 }
135 160
136 /* update core and thread sibling masks */ 161 update_siblings_masks(cpuid);
137 for_each_possible_cpu(cpu) {
138 struct cputopo_arm *cpu_topo = &cpu_topology[cpu];
139
140 if (cpuid_topo->socket_id == cpu_topo->socket_id) {
141 cpumask_set_cpu(cpuid, &cpu_topo->core_sibling);
142 if (cpu != cpuid)
143 cpumask_set_cpu(cpu,
144 &cpuid_topo->core_sibling);
145
146 if (cpuid_topo->core_id == cpu_topo->core_id) {
147 cpumask_set_cpu(cpuid,
148 &cpu_topo->thread_sibling);
149 if (cpu != cpuid)
150 cpumask_set_cpu(cpu,
151 &cpuid_topo->thread_sibling);
152 }
153 }
154 }
155 smp_wmb();
156 162
157 printk(KERN_INFO "CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n", 163 printk(KERN_INFO "CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n",
158 cpuid, cpu_topology[cpuid].thread_id, 164 cpuid, cpu_topology[cpuid].thread_id,