aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r--arch/x86/kernel/acpi/boot.c17
-rw-r--r--arch/x86/kernel/acpi/cstate.c74
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
-rw-r--r--arch/x86/kernel/cpu/common.c26
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c170
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longhaul.c2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c8
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.h2
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c35
-rw-r--r--arch/x86/kernel/cpu/cpufreq/speedstep-ich.c18
-rw-r--r--arch/x86/kernel/e820.c21
-rw-r--r--arch/x86/kernel/early-quirks.c22
-rw-r--r--arch/x86/kernel/kprobes.c9
-rw-r--r--arch/x86/kernel/mfgpt_32.c2
-rw-r--r--arch/x86/kernel/pci-dma.c2
-rw-r--r--arch/x86/kernel/pci-swiotlb_64.c2
-rw-r--r--arch/x86/kernel/setup_percpu.c25
-rw-r--r--arch/x86/kernel/smp.c17
-rw-r--r--arch/x86/kernel/smpboot.c128
-rw-r--r--arch/x86/kernel/traps.c2
21 files changed, 345 insertions, 245 deletions
diff --git a/arch/x86/kernel/acpi/boot.c b/arch/x86/kernel/acpi/boot.c
index 29dc0c89d4af..d37593c2f438 100644
--- a/arch/x86/kernel/acpi/boot.c
+++ b/arch/x86/kernel/acpi/boot.c
@@ -47,7 +47,7 @@
47#endif 47#endif
48 48
49static int __initdata acpi_force = 0; 49static int __initdata acpi_force = 0;
50 50u32 acpi_rsdt_forced;
51#ifdef CONFIG_ACPI 51#ifdef CONFIG_ACPI
52int acpi_disabled = 0; 52int acpi_disabled = 0;
53#else 53#else
@@ -1374,6 +1374,17 @@ static void __init acpi_process_madt(void)
1374 "Invalid BIOS MADT, disabling ACPI\n"); 1374 "Invalid BIOS MADT, disabling ACPI\n");
1375 disable_acpi(); 1375 disable_acpi();
1376 } 1376 }
1377 } else {
1378 /*
1379 * ACPI found no MADT, and so ACPI wants UP PIC mode.
1380 * In the event an MPS table was found, forget it.
1381 * Boot with "acpi=off" to use MPS on such a system.
1382 */
1383 if (smp_found_config) {
1384 printk(KERN_WARNING PREFIX
1385 "No APIC-table, disabling MPS\n");
1386 smp_found_config = 0;
1387 }
1377 } 1388 }
1378 1389
1379 /* 1390 /*
@@ -1809,6 +1820,10 @@ static int __init parse_acpi(char *arg)
1809 disable_acpi(); 1820 disable_acpi();
1810 acpi_ht = 1; 1821 acpi_ht = 1;
1811 } 1822 }
1823 /* acpi=rsdt use RSDT instead of XSDT */
1824 else if (strcmp(arg, "rsdt") == 0) {
1825 acpi_rsdt_forced = 1;
1826 }
1812 /* "acpi=noirq" disables ACPI interrupt routing */ 1827 /* "acpi=noirq" disables ACPI interrupt routing */
1813 else if (strcmp(arg, "noirq") == 0) { 1828 else if (strcmp(arg, "noirq") == 0) {
1814 acpi_noirq_set(); 1829 acpi_noirq_set();
diff --git a/arch/x86/kernel/acpi/cstate.c b/arch/x86/kernel/acpi/cstate.c
index c2502eb9aa83..bbbe4bbb6f34 100644
--- a/arch/x86/kernel/acpi/cstate.c
+++ b/arch/x86/kernel/acpi/cstate.c
@@ -56,6 +56,7 @@ static struct cstate_entry *cpu_cstate_entry; /* per CPU ptr */
56static short mwait_supported[ACPI_PROCESSOR_MAX_POWER]; 56static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
57 57
58#define MWAIT_SUBSTATE_MASK (0xf) 58#define MWAIT_SUBSTATE_MASK (0xf)
59#define MWAIT_CSTATE_MASK (0xf)
59#define MWAIT_SUBSTATE_SIZE (4) 60#define MWAIT_SUBSTATE_SIZE (4)
60 61
61#define CPUID_MWAIT_LEAF (5) 62#define CPUID_MWAIT_LEAF (5)
@@ -66,39 +67,20 @@ static short mwait_supported[ACPI_PROCESSOR_MAX_POWER];
66 67
67#define NATIVE_CSTATE_BEYOND_HALT (2) 68#define NATIVE_CSTATE_BEYOND_HALT (2)
68 69
69int acpi_processor_ffh_cstate_probe(unsigned int cpu, 70static long acpi_processor_ffh_cstate_probe_cpu(void *_cx)
70 struct acpi_processor_cx *cx, struct acpi_power_register *reg)
71{ 71{
72 struct cstate_entry *percpu_entry; 72 struct acpi_processor_cx *cx = _cx;
73 struct cpuinfo_x86 *c = &cpu_data(cpu); 73 long retval;
74
75 cpumask_t saved_mask;
76 int retval;
77 unsigned int eax, ebx, ecx, edx; 74 unsigned int eax, ebx, ecx, edx;
78 unsigned int edx_part; 75 unsigned int edx_part;
79 unsigned int cstate_type; /* C-state type and not ACPI C-state type */ 76 unsigned int cstate_type; /* C-state type and not ACPI C-state type */
80 unsigned int num_cstate_subtype; 77 unsigned int num_cstate_subtype;
81 78
82 if (!cpu_cstate_entry || c->cpuid_level < CPUID_MWAIT_LEAF )
83 return -1;
84
85 if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT)
86 return -1;
87
88 percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
89 percpu_entry->states[cx->index].eax = 0;
90 percpu_entry->states[cx->index].ecx = 0;
91
92 /* Make sure we are running on right CPU */
93 saved_mask = current->cpus_allowed;
94 retval = set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
95 if (retval)
96 return -1;
97
98 cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx); 79 cpuid(CPUID_MWAIT_LEAF, &eax, &ebx, &ecx, &edx);
99 80
100 /* Check whether this particular cx_type (in CST) is supported or not */ 81 /* Check whether this particular cx_type (in CST) is supported or not */
101 cstate_type = (cx->address >> MWAIT_SUBSTATE_SIZE) + 1; 82 cstate_type = ((cx->address >> MWAIT_SUBSTATE_SIZE) &
83 MWAIT_CSTATE_MASK) + 1;
102 edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE); 84 edx_part = edx >> (cstate_type * MWAIT_SUBSTATE_SIZE);
103 num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK; 85 num_cstate_subtype = edx_part & MWAIT_SUBSTATE_MASK;
104 86
@@ -114,21 +96,45 @@ int acpi_processor_ffh_cstate_probe(unsigned int cpu,
114 retval = -1; 96 retval = -1;
115 goto out; 97 goto out;
116 } 98 }
117 percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
118
119 /* Use the hint in CST */
120 percpu_entry->states[cx->index].eax = cx->address;
121 99
122 if (!mwait_supported[cstate_type]) { 100 if (!mwait_supported[cstate_type]) {
123 mwait_supported[cstate_type] = 1; 101 mwait_supported[cstate_type] = 1;
124 printk(KERN_DEBUG "Monitor-Mwait will be used to enter C-%d " 102 printk(KERN_DEBUG
125 "state\n", cx->type); 103 "Monitor-Mwait will be used to enter C-%d "
104 "state\n", cx->type);
126 } 105 }
127 snprintf(cx->desc, ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x", 106 snprintf(cx->desc,
128 cx->address); 107 ACPI_CX_DESC_LEN, "ACPI FFH INTEL MWAIT 0x%x",
129 108 cx->address);
130out: 109out:
131 set_cpus_allowed_ptr(current, &saved_mask); 110 return retval;
111}
112
113int acpi_processor_ffh_cstate_probe(unsigned int cpu,
114 struct acpi_processor_cx *cx, struct acpi_power_register *reg)
115{
116 struct cstate_entry *percpu_entry;
117 struct cpuinfo_x86 *c = &cpu_data(cpu);
118 long retval;
119
120 if (!cpu_cstate_entry || c->cpuid_level < CPUID_MWAIT_LEAF)
121 return -1;
122
123 if (reg->bit_offset != NATIVE_CSTATE_BEYOND_HALT)
124 return -1;
125
126 percpu_entry = per_cpu_ptr(cpu_cstate_entry, cpu);
127 percpu_entry->states[cx->index].eax = 0;
128 percpu_entry->states[cx->index].ecx = 0;
129
130 /* Make sure we are running on right CPU */
131
132 retval = work_on_cpu(cpu, acpi_processor_ffh_cstate_probe_cpu, cx);
133 if (retval == 0) {
134 /* Use the hint in CST */
135 percpu_entry->states[cx->index].eax = cx->address;
136 percpu_entry->states[cx->index].ecx = MWAIT_ECX_INTERRUPT_BREAK;
137 }
132 return retval; 138 return retval;
133} 139}
134EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe); 140EXPORT_SYMBOL_GPL(acpi_processor_ffh_cstate_probe);
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index 806b4e9051b4..707c1f6f95fa 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -159,6 +159,8 @@ static int __init acpi_sleep_setup(char *str)
159#endif 159#endif
160 if (strncmp(str, "old_ordering", 12) == 0) 160 if (strncmp(str, "old_ordering", 12) == 0)
161 acpi_old_suspend_ordering(); 161 acpi_old_suspend_ordering();
162 if (strncmp(str, "s4_nonvs", 8) == 0)
163 acpi_s4_no_nvs();
162 str = strchr(str, ','); 164 str = strchr(str, ',');
163 if (str != NULL) 165 if (str != NULL)
164 str += strspn(str, ", \t"); 166 str += strspn(str, ", \t");
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index f7619a2eaffe..14e543b6fd4f 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -41,6 +41,26 @@
41 41
42#include "cpu.h" 42#include "cpu.h"
43 43
44#ifdef CONFIG_X86_64
45
46/* all of these masks are initialized in setup_cpu_local_masks() */
47cpumask_var_t cpu_callin_mask;
48cpumask_var_t cpu_callout_mask;
49cpumask_var_t cpu_initialized_mask;
50
51/* representing cpus for which sibling maps can be computed */
52cpumask_var_t cpu_sibling_setup_mask;
53
54#else /* CONFIG_X86_32 */
55
56cpumask_t cpu_callin_map;
57cpumask_t cpu_callout_map;
58cpumask_t cpu_initialized;
59cpumask_t cpu_sibling_setup_map;
60
61#endif /* CONFIG_X86_32 */
62
63
44static struct cpu_dev *this_cpu __cpuinitdata; 64static struct cpu_dev *this_cpu __cpuinitdata;
45 65
46#ifdef CONFIG_X86_64 66#ifdef CONFIG_X86_64
@@ -857,8 +877,6 @@ static __init int setup_disablecpuid(char *arg)
857} 877}
858__setup("clearcpuid=", setup_disablecpuid); 878__setup("clearcpuid=", setup_disablecpuid);
859 879
860cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
861
862#ifdef CONFIG_X86_64 880#ifdef CONFIG_X86_64
863struct x8664_pda **_cpu_pda __read_mostly; 881struct x8664_pda **_cpu_pda __read_mostly;
864EXPORT_SYMBOL(_cpu_pda); 882EXPORT_SYMBOL(_cpu_pda);
@@ -977,7 +995,7 @@ void __cpuinit cpu_init(void)
977 995
978 me = current; 996 me = current;
979 997
980 if (cpu_test_and_set(cpu, cpu_initialized)) 998 if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask))
981 panic("CPU#%d already initialized!\n", cpu); 999 panic("CPU#%d already initialized!\n", cpu);
982 1000
983 printk(KERN_INFO "Initializing CPU#%d\n", cpu); 1001 printk(KERN_INFO "Initializing CPU#%d\n", cpu);
@@ -1086,7 +1104,7 @@ void __cpuinit cpu_init(void)
1086 struct tss_struct *t = &per_cpu(init_tss, cpu); 1104 struct tss_struct *t = &per_cpu(init_tss, cpu);
1087 struct thread_struct *thread = &curr->thread; 1105 struct thread_struct *thread = &curr->thread;
1088 1106
1089 if (cpu_test_and_set(cpu, cpu_initialized)) { 1107 if (cpumask_test_and_set_cpu(cpu, cpu_initialized_mask)) {
1090 printk(KERN_WARNING "CPU#%d already initialized!\n", cpu); 1108 printk(KERN_WARNING "CPU#%d already initialized!\n", cpu);
1091 for (;;) local_irq_enable(); 1109 for (;;) local_irq_enable();
1092 } 1110 }
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 28102ad1a363..06fcd8f9323c 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -145,13 +145,14 @@ typedef union {
145 145
146struct drv_cmd { 146struct drv_cmd {
147 unsigned int type; 147 unsigned int type;
148 cpumask_t mask; 148 cpumask_var_t mask;
149 drv_addr_union addr; 149 drv_addr_union addr;
150 u32 val; 150 u32 val;
151}; 151};
152 152
153static void do_drv_read(struct drv_cmd *cmd) 153static long do_drv_read(void *_cmd)
154{ 154{
155 struct drv_cmd *cmd = _cmd;
155 u32 h; 156 u32 h;
156 157
157 switch (cmd->type) { 158 switch (cmd->type) {
@@ -166,10 +167,12 @@ static void do_drv_read(struct drv_cmd *cmd)
166 default: 167 default:
167 break; 168 break;
168 } 169 }
170 return 0;
169} 171}
170 172
171static void do_drv_write(struct drv_cmd *cmd) 173static long do_drv_write(void *_cmd)
172{ 174{
175 struct drv_cmd *cmd = _cmd;
173 u32 lo, hi; 176 u32 lo, hi;
174 177
175 switch (cmd->type) { 178 switch (cmd->type) {
@@ -186,48 +189,41 @@ static void do_drv_write(struct drv_cmd *cmd)
186 default: 189 default:
187 break; 190 break;
188 } 191 }
192 return 0;
189} 193}
190 194
191static void drv_read(struct drv_cmd *cmd) 195static void drv_read(struct drv_cmd *cmd)
192{ 196{
193 cpumask_t saved_mask = current->cpus_allowed;
194 cmd->val = 0; 197 cmd->val = 0;
195 198
196 set_cpus_allowed_ptr(current, &cmd->mask); 199 work_on_cpu(cpumask_any(cmd->mask), do_drv_read, cmd);
197 do_drv_read(cmd);
198 set_cpus_allowed_ptr(current, &saved_mask);
199} 200}
200 201
201static void drv_write(struct drv_cmd *cmd) 202static void drv_write(struct drv_cmd *cmd)
202{ 203{
203 cpumask_t saved_mask = current->cpus_allowed;
204 unsigned int i; 204 unsigned int i;
205 205
206 for_each_cpu_mask_nr(i, cmd->mask) { 206 for_each_cpu(i, cmd->mask) {
207 set_cpus_allowed_ptr(current, &cpumask_of_cpu(i)); 207 work_on_cpu(i, do_drv_write, cmd);
208 do_drv_write(cmd);
209 } 208 }
210
211 set_cpus_allowed_ptr(current, &saved_mask);
212 return;
213} 209}
214 210
215static u32 get_cur_val(const cpumask_t *mask) 211static u32 get_cur_val(const struct cpumask *mask)
216{ 212{
217 struct acpi_processor_performance *perf; 213 struct acpi_processor_performance *perf;
218 struct drv_cmd cmd; 214 struct drv_cmd cmd;
219 215
220 if (unlikely(cpus_empty(*mask))) 216 if (unlikely(cpumask_empty(mask)))
221 return 0; 217 return 0;
222 218
223 switch (per_cpu(drv_data, first_cpu(*mask))->cpu_feature) { 219 switch (per_cpu(drv_data, cpumask_first(mask))->cpu_feature) {
224 case SYSTEM_INTEL_MSR_CAPABLE: 220 case SYSTEM_INTEL_MSR_CAPABLE:
225 cmd.type = SYSTEM_INTEL_MSR_CAPABLE; 221 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
226 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS; 222 cmd.addr.msr.reg = MSR_IA32_PERF_STATUS;
227 break; 223 break;
228 case SYSTEM_IO_CAPABLE: 224 case SYSTEM_IO_CAPABLE:
229 cmd.type = SYSTEM_IO_CAPABLE; 225 cmd.type = SYSTEM_IO_CAPABLE;
230 perf = per_cpu(drv_data, first_cpu(*mask))->acpi_data; 226 perf = per_cpu(drv_data, cpumask_first(mask))->acpi_data;
231 cmd.addr.io.port = perf->control_register.address; 227 cmd.addr.io.port = perf->control_register.address;
232 cmd.addr.io.bit_width = perf->control_register.bit_width; 228 cmd.addr.io.bit_width = perf->control_register.bit_width;
233 break; 229 break;
@@ -235,15 +231,44 @@ static u32 get_cur_val(const cpumask_t *mask)
235 return 0; 231 return 0;
236 } 232 }
237 233
238 cmd.mask = *mask; 234 if (unlikely(!alloc_cpumask_var(&cmd.mask, GFP_KERNEL)))
235 return 0;
236
237 cpumask_copy(cmd.mask, mask);
239 238
240 drv_read(&cmd); 239 drv_read(&cmd);
241 240
241 free_cpumask_var(cmd.mask);
242
242 dprintk("get_cur_val = %u\n", cmd.val); 243 dprintk("get_cur_val = %u\n", cmd.val);
243 244
244 return cmd.val; 245 return cmd.val;
245} 246}
246 247
248struct perf_cur {
249 union {
250 struct {
251 u32 lo;
252 u32 hi;
253 } split;
254 u64 whole;
255 } aperf_cur, mperf_cur;
256};
257
258
259static long read_measured_perf_ctrs(void *_cur)
260{
261 struct perf_cur *cur = _cur;
262
263 rdmsr(MSR_IA32_APERF, cur->aperf_cur.split.lo, cur->aperf_cur.split.hi);
264 rdmsr(MSR_IA32_MPERF, cur->mperf_cur.split.lo, cur->mperf_cur.split.hi);
265
266 wrmsr(MSR_IA32_APERF, 0, 0);
267 wrmsr(MSR_IA32_MPERF, 0, 0);
268
269 return 0;
270}
271
247/* 272/*
248 * Return the measured active (C0) frequency on this CPU since last call 273 * Return the measured active (C0) frequency on this CPU since last call
249 * to this function. 274 * to this function.
@@ -260,31 +285,12 @@ static u32 get_cur_val(const cpumask_t *mask)
260static unsigned int get_measured_perf(struct cpufreq_policy *policy, 285static unsigned int get_measured_perf(struct cpufreq_policy *policy,
261 unsigned int cpu) 286 unsigned int cpu)
262{ 287{
263 union { 288 struct perf_cur cur;
264 struct {
265 u32 lo;
266 u32 hi;
267 } split;
268 u64 whole;
269 } aperf_cur, mperf_cur;
270
271 cpumask_t saved_mask;
272 unsigned int perf_percent; 289 unsigned int perf_percent;
273 unsigned int retval; 290 unsigned int retval;
274 291
275 saved_mask = current->cpus_allowed; 292 if (!work_on_cpu(cpu, read_measured_perf_ctrs, &cur))
276 set_cpus_allowed_ptr(current, &cpumask_of_cpu(cpu));
277 if (get_cpu() != cpu) {
278 /* We were not able to run on requested processor */
279 put_cpu();
280 return 0; 293 return 0;
281 }
282
283 rdmsr(MSR_IA32_APERF, aperf_cur.split.lo, aperf_cur.split.hi);
284 rdmsr(MSR_IA32_MPERF, mperf_cur.split.lo, mperf_cur.split.hi);
285
286 wrmsr(MSR_IA32_APERF, 0,0);
287 wrmsr(MSR_IA32_MPERF, 0,0);
288 294
289#ifdef __i386__ 295#ifdef __i386__
290 /* 296 /*
@@ -292,37 +298,39 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,
292 * Get an approximate value. Return failure in case we cannot get 298 * Get an approximate value. Return failure in case we cannot get
293 * an approximate value. 299 * an approximate value.
294 */ 300 */
295 if (unlikely(aperf_cur.split.hi || mperf_cur.split.hi)) { 301 if (unlikely(cur.aperf_cur.split.hi || cur.mperf_cur.split.hi)) {
296 int shift_count; 302 int shift_count;
297 u32 h; 303 u32 h;
298 304
299 h = max_t(u32, aperf_cur.split.hi, mperf_cur.split.hi); 305 h = max_t(u32, cur.aperf_cur.split.hi, cur.mperf_cur.split.hi);
300 shift_count = fls(h); 306 shift_count = fls(h);
301 307
302 aperf_cur.whole >>= shift_count; 308 cur.aperf_cur.whole >>= shift_count;
303 mperf_cur.whole >>= shift_count; 309 cur.mperf_cur.whole >>= shift_count;
304 } 310 }
305 311
306 if (((unsigned long)(-1) / 100) < aperf_cur.split.lo) { 312 if (((unsigned long)(-1) / 100) < cur.aperf_cur.split.lo) {
307 int shift_count = 7; 313 int shift_count = 7;
308 aperf_cur.split.lo >>= shift_count; 314 cur.aperf_cur.split.lo >>= shift_count;
309 mperf_cur.split.lo >>= shift_count; 315 cur.mperf_cur.split.lo >>= shift_count;
310 } 316 }
311 317
312 if (aperf_cur.split.lo && mperf_cur.split.lo) 318 if (cur.aperf_cur.split.lo && cur.mperf_cur.split.lo)
313 perf_percent = (aperf_cur.split.lo * 100) / mperf_cur.split.lo; 319 perf_percent = (cur.aperf_cur.split.lo * 100) /
320 cur.mperf_cur.split.lo;
314 else 321 else
315 perf_percent = 0; 322 perf_percent = 0;
316 323
317#else 324#else
318 if (unlikely(((unsigned long)(-1) / 100) < aperf_cur.whole)) { 325 if (unlikely(((unsigned long)(-1) / 100) < cur.aperf_cur.whole)) {
319 int shift_count = 7; 326 int shift_count = 7;
320 aperf_cur.whole >>= shift_count; 327 cur.aperf_cur.whole >>= shift_count;
321 mperf_cur.whole >>= shift_count; 328 cur.mperf_cur.whole >>= shift_count;
322 } 329 }
323 330
324 if (aperf_cur.whole && mperf_cur.whole) 331 if (cur.aperf_cur.whole && cur.mperf_cur.whole)
325 perf_percent = (aperf_cur.whole * 100) / mperf_cur.whole; 332 perf_percent = (cur.aperf_cur.whole * 100) /
333 cur.mperf_cur.whole;
326 else 334 else
327 perf_percent = 0; 335 perf_percent = 0;
328 336
@@ -330,10 +338,6 @@ static unsigned int get_measured_perf(struct cpufreq_policy *policy,
330 338
331 retval = per_cpu(drv_data, policy->cpu)->max_freq * perf_percent / 100; 339 retval = per_cpu(drv_data, policy->cpu)->max_freq * perf_percent / 100;
332 340
333 put_cpu();
334 set_cpus_allowed_ptr(current, &saved_mask);
335
336 dprintk("cpu %d: performance percent %d\n", cpu, perf_percent);
337 return retval; 341 return retval;
338} 342}
339 343
@@ -351,7 +355,7 @@ static unsigned int get_cur_freq_on_cpu(unsigned int cpu)
351 } 355 }
352 356
353 cached_freq = data->freq_table[data->acpi_data->state].frequency; 357 cached_freq = data->freq_table[data->acpi_data->state].frequency;
354 freq = extract_freq(get_cur_val(&cpumask_of_cpu(cpu)), data); 358 freq = extract_freq(get_cur_val(cpumask_of(cpu)), data);
355 if (freq != cached_freq) { 359 if (freq != cached_freq) {
356 /* 360 /*
357 * The dreaded BIOS frequency change behind our back. 361 * The dreaded BIOS frequency change behind our back.
@@ -386,7 +390,6 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
386 struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu); 390 struct acpi_cpufreq_data *data = per_cpu(drv_data, policy->cpu);
387 struct acpi_processor_performance *perf; 391 struct acpi_processor_performance *perf;
388 struct cpufreq_freqs freqs; 392 struct cpufreq_freqs freqs;
389 cpumask_t online_policy_cpus;
390 struct drv_cmd cmd; 393 struct drv_cmd cmd;
391 unsigned int next_state = 0; /* Index into freq_table */ 394 unsigned int next_state = 0; /* Index into freq_table */
392 unsigned int next_perf_state = 0; /* Index into perf table */ 395 unsigned int next_perf_state = 0; /* Index into perf table */
@@ -401,20 +404,18 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
401 return -ENODEV; 404 return -ENODEV;
402 } 405 }
403 406
407 if (unlikely(!alloc_cpumask_var(&cmd.mask, GFP_KERNEL)))
408 return -ENOMEM;
409
404 perf = data->acpi_data; 410 perf = data->acpi_data;
405 result = cpufreq_frequency_table_target(policy, 411 result = cpufreq_frequency_table_target(policy,
406 data->freq_table, 412 data->freq_table,
407 target_freq, 413 target_freq,
408 relation, &next_state); 414 relation, &next_state);
409 if (unlikely(result)) 415 if (unlikely(result)) {
410 return -ENODEV; 416 result = -ENODEV;
411 417 goto out;
412#ifdef CONFIG_HOTPLUG_CPU 418 }
413 /* cpufreq holds the hotplug lock, so we are safe from here on */
414 cpus_and(online_policy_cpus, cpu_online_map, policy->cpus);
415#else
416 online_policy_cpus = policy->cpus;
417#endif
418 419
419 next_perf_state = data->freq_table[next_state].index; 420 next_perf_state = data->freq_table[next_state].index;
420 if (perf->state == next_perf_state) { 421 if (perf->state == next_perf_state) {
@@ -425,7 +426,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
425 } else { 426 } else {
426 dprintk("Already at target state (P%d)\n", 427 dprintk("Already at target state (P%d)\n",
427 next_perf_state); 428 next_perf_state);
428 return 0; 429 goto out;
429 } 430 }
430 } 431 }
431 432
@@ -444,19 +445,19 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
444 cmd.val = (u32) perf->states[next_perf_state].control; 445 cmd.val = (u32) perf->states[next_perf_state].control;
445 break; 446 break;
446 default: 447 default:
447 return -ENODEV; 448 result = -ENODEV;
449 goto out;
448 } 450 }
449 451
450 cpus_clear(cmd.mask); 452 /* cpufreq holds the hotplug lock, so we are safe from here on */
451
452 if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY) 453 if (policy->shared_type != CPUFREQ_SHARED_TYPE_ANY)
453 cmd.mask = online_policy_cpus; 454 cpumask_and(cmd.mask, cpu_online_mask, policy->cpus);
454 else 455 else
455 cpu_set(policy->cpu, cmd.mask); 456 cpumask_copy(cmd.mask, cpumask_of(policy->cpu));
456 457
457 freqs.old = perf->states[perf->state].core_frequency * 1000; 458 freqs.old = perf->states[perf->state].core_frequency * 1000;
458 freqs.new = data->freq_table[next_state].frequency; 459 freqs.new = data->freq_table[next_state].frequency;
459 for_each_cpu_mask_nr(i, cmd.mask) { 460 for_each_cpu(i, cmd.mask) {
460 freqs.cpu = i; 461 freqs.cpu = i;
461 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 462 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
462 } 463 }
@@ -464,19 +465,22 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
464 drv_write(&cmd); 465 drv_write(&cmd);
465 466
466 if (acpi_pstate_strict) { 467 if (acpi_pstate_strict) {
467 if (!check_freqs(&cmd.mask, freqs.new, data)) { 468 if (!check_freqs(cmd.mask, freqs.new, data)) {
468 dprintk("acpi_cpufreq_target failed (%d)\n", 469 dprintk("acpi_cpufreq_target failed (%d)\n",
469 policy->cpu); 470 policy->cpu);
470 return -EAGAIN; 471 result = -EAGAIN;
472 goto out;
471 } 473 }
472 } 474 }
473 475
474 for_each_cpu_mask_nr(i, cmd.mask) { 476 for_each_cpu(i, cmd.mask) {
475 freqs.cpu = i; 477 freqs.cpu = i;
476 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 478 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
477 } 479 }
478 perf->state = next_perf_state; 480 perf->state = next_perf_state;
479 481
482out:
483 free_cpumask_var(cmd.mask);
480 return result; 484 return result;
481} 485}
482 486
@@ -626,15 +630,15 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
626 */ 630 */
627 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL || 631 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ALL ||
628 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) { 632 policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) {
629 cpumask_copy(&policy->cpus, perf->shared_cpu_map); 633 cpumask_copy(policy->cpus, perf->shared_cpu_map);
630 } 634 }
631 cpumask_copy(&policy->related_cpus, perf->shared_cpu_map); 635 cpumask_copy(policy->related_cpus, perf->shared_cpu_map);
632 636
633#ifdef CONFIG_SMP 637#ifdef CONFIG_SMP
634 dmi_check_system(sw_any_bug_dmi_table); 638 dmi_check_system(sw_any_bug_dmi_table);
635 if (bios_with_sw_any_bug && cpus_weight(policy->cpus) == 1) { 639 if (bios_with_sw_any_bug && cpumask_weight(policy->cpus) == 1) {
636 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL; 640 policy->shared_type = CPUFREQ_SHARED_TYPE_ALL;
637 policy->cpus = per_cpu(cpu_core_map, cpu); 641 cpumask_copy(policy->cpus, cpu_core_mask(cpu));
638 } 642 }
639#endif 643#endif
640 644
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c
index b0461856acfb..a4cff5d6e380 100644
--- a/arch/x86/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c
@@ -982,7 +982,7 @@ static int __init longhaul_init(void)
982 case 10: 982 case 10:
983 printk(KERN_ERR PFX "Use acpi-cpufreq driver for VIA C7\n"); 983 printk(KERN_ERR PFX "Use acpi-cpufreq driver for VIA C7\n");
984 default: 984 default:
985 ;; 985 ;
986 } 986 }
987 987
988 return -ENODEV; 988 return -ENODEV;
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index beea4466b063..b585e04cbc9e 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -122,7 +122,7 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
122 return 0; 122 return 0;
123 123
124 /* notifiers */ 124 /* notifiers */
125 for_each_cpu_mask_nr(i, policy->cpus) { 125 for_each_cpu(i, policy->cpus) {
126 freqs.cpu = i; 126 freqs.cpu = i;
127 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 127 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
128 } 128 }
@@ -130,11 +130,11 @@ static int cpufreq_p4_target(struct cpufreq_policy *policy,
130 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software 130 /* run on each logical CPU, see section 13.15.3 of IA32 Intel Architecture Software
131 * Developer's Manual, Volume 3 131 * Developer's Manual, Volume 3
132 */ 132 */
133 for_each_cpu_mask_nr(i, policy->cpus) 133 for_each_cpu(i, policy->cpus)
134 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index); 134 cpufreq_p4_setdc(i, p4clockmod_table[newstate].index);
135 135
136 /* notifiers */ 136 /* notifiers */
137 for_each_cpu_mask_nr(i, policy->cpus) { 137 for_each_cpu(i, policy->cpus) {
138 freqs.cpu = i; 138 freqs.cpu = i;
139 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 139 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
140 } 140 }
@@ -203,7 +203,7 @@ static int cpufreq_p4_cpu_init(struct cpufreq_policy *policy)
203 unsigned int i; 203 unsigned int i;
204 204
205#ifdef CONFIG_SMP 205#ifdef CONFIG_SMP
206 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu); 206 cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu));
207#endif 207#endif
208 208
209 /* Errata workaround */ 209 /* Errata workaround */
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index c3c9adbaa26f..5c28b37dea11 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -1199,10 +1199,10 @@ static int __cpuinit powernowk8_cpu_init(struct cpufreq_policy *pol)
1199 set_cpus_allowed_ptr(current, &oldmask); 1199 set_cpus_allowed_ptr(current, &oldmask);
1200 1200
1201 if (cpu_family == CPU_HW_PSTATE) 1201 if (cpu_family == CPU_HW_PSTATE)
1202 pol->cpus = cpumask_of_cpu(pol->cpu); 1202 cpumask_copy(pol->cpus, cpumask_of(pol->cpu));
1203 else 1203 else
1204 pol->cpus = per_cpu(cpu_core_map, pol->cpu); 1204 cpumask_copy(pol->cpus, &per_cpu(cpu_core_map, pol->cpu));
1205 data->available_cores = &(pol->cpus); 1205 data->available_cores = pol->cpus;
1206 1206
1207 /* Take a crude guess here. 1207 /* Take a crude guess here.
1208 * That guess was in microseconds, so multiply with 1000 */ 1208 * That guess was in microseconds, so multiply with 1000 */
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
index 65cfb5d7f77f..8ecc75b6c7c3 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.h
@@ -53,7 +53,7 @@ struct powernow_k8_data {
53 /* we need to keep track of associated cores, but let cpufreq 53 /* we need to keep track of associated cores, but let cpufreq
54 * handle hotplug events - so just point at cpufreq pol->cpus 54 * handle hotplug events - so just point at cpufreq pol->cpus
55 * structure */ 55 * structure */
56 cpumask_t *available_cores; 56 struct cpumask *available_cores;
57}; 57};
58 58
59 59
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
index f0ea6fa2f53c..f08998278a3a 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-centrino.c
@@ -458,11 +458,6 @@ static int centrino_verify (struct cpufreq_policy *policy)
458 * 458 *
459 * Sets a new CPUFreq policy. 459 * Sets a new CPUFreq policy.
460 */ 460 */
461struct allmasks {
462 cpumask_t saved_mask;
463 cpumask_t covered_cpus;
464};
465
466static int centrino_target (struct cpufreq_policy *policy, 461static int centrino_target (struct cpufreq_policy *policy,
467 unsigned int target_freq, 462 unsigned int target_freq,
468 unsigned int relation) 463 unsigned int relation)
@@ -472,12 +467,15 @@ static int centrino_target (struct cpufreq_policy *policy,
472 struct cpufreq_freqs freqs; 467 struct cpufreq_freqs freqs;
473 int retval = 0; 468 int retval = 0;
474 unsigned int j, k, first_cpu, tmp; 469 unsigned int j, k, first_cpu, tmp;
475 CPUMASK_ALLOC(allmasks); 470 cpumask_var_t saved_mask, covered_cpus;
476 CPUMASK_PTR(saved_mask, allmasks);
477 CPUMASK_PTR(covered_cpus, allmasks);
478 471
479 if (unlikely(allmasks == NULL)) 472 if (unlikely(!alloc_cpumask_var(&saved_mask, GFP_KERNEL)))
480 return -ENOMEM; 473 return -ENOMEM;
474 if (unlikely(!alloc_cpumask_var(&covered_cpus, GFP_KERNEL))) {
475 free_cpumask_var(saved_mask);
476 return -ENOMEM;
477 }
478 cpumask_copy(saved_mask, &current->cpus_allowed);
481 479
482 if (unlikely(per_cpu(centrino_model, cpu) == NULL)) { 480 if (unlikely(per_cpu(centrino_model, cpu) == NULL)) {
483 retval = -ENODEV; 481 retval = -ENODEV;
@@ -493,11 +491,9 @@ static int centrino_target (struct cpufreq_policy *policy,
493 goto out; 491 goto out;
494 } 492 }
495 493
496 *saved_mask = current->cpus_allowed;
497 first_cpu = 1; 494 first_cpu = 1;
498 cpus_clear(*covered_cpus); 495 for_each_cpu(j, policy->cpus) {
499 for_each_cpu_mask_nr(j, policy->cpus) { 496 const struct cpumask *mask;
500 const cpumask_t *mask;
501 497
502 /* cpufreq holds the hotplug lock, so we are safe here */ 498 /* cpufreq holds the hotplug lock, so we are safe here */
503 if (!cpu_online(j)) 499 if (!cpu_online(j))
@@ -508,9 +504,9 @@ static int centrino_target (struct cpufreq_policy *policy,
508 * Make sure we are running on CPU that wants to change freq 504 * Make sure we are running on CPU that wants to change freq
509 */ 505 */
510 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY) 506 if (policy->shared_type == CPUFREQ_SHARED_TYPE_ANY)
511 mask = &policy->cpus; 507 mask = policy->cpus;
512 else 508 else
513 mask = &cpumask_of_cpu(j); 509 mask = cpumask_of(j);
514 510
515 set_cpus_allowed_ptr(current, mask); 511 set_cpus_allowed_ptr(current, mask);
516 preempt_disable(); 512 preempt_disable();
@@ -542,7 +538,7 @@ static int centrino_target (struct cpufreq_policy *policy,
542 dprintk("target=%dkHz old=%d new=%d msr=%04x\n", 538 dprintk("target=%dkHz old=%d new=%d msr=%04x\n",
543 target_freq, freqs.old, freqs.new, msr); 539 target_freq, freqs.old, freqs.new, msr);
544 540
545 for_each_cpu_mask_nr(k, policy->cpus) { 541 for_each_cpu(k, policy->cpus) {
546 if (!cpu_online(k)) 542 if (!cpu_online(k))
547 continue; 543 continue;
548 freqs.cpu = k; 544 freqs.cpu = k;
@@ -567,7 +563,7 @@ static int centrino_target (struct cpufreq_policy *policy,
567 preempt_enable(); 563 preempt_enable();
568 } 564 }
569 565
570 for_each_cpu_mask_nr(k, policy->cpus) { 566 for_each_cpu(k, policy->cpus) {
571 if (!cpu_online(k)) 567 if (!cpu_online(k))
572 continue; 568 continue;
573 freqs.cpu = k; 569 freqs.cpu = k;
@@ -590,7 +586,7 @@ static int centrino_target (struct cpufreq_policy *policy,
590 tmp = freqs.new; 586 tmp = freqs.new;
591 freqs.new = freqs.old; 587 freqs.new = freqs.old;
592 freqs.old = tmp; 588 freqs.old = tmp;
593 for_each_cpu_mask_nr(j, policy->cpus) { 589 for_each_cpu(j, policy->cpus) {
594 if (!cpu_online(j)) 590 if (!cpu_online(j))
595 continue; 591 continue;
596 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 592 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
@@ -605,7 +601,8 @@ migrate_end:
605 preempt_enable(); 601 preempt_enable();
606 set_cpus_allowed_ptr(current, saved_mask); 602 set_cpus_allowed_ptr(current, saved_mask);
607out: 603out:
608 CPUMASK_FREE(allmasks); 604 free_cpumask_var(saved_mask);
605 free_cpumask_var(covered_cpus);
609 return retval; 606 return retval;
610} 607}
611 608
diff --git a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
index 04d0376b64b0..dedc1e98f168 100644
--- a/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
+++ b/arch/x86/kernel/cpu/cpufreq/speedstep-ich.c
@@ -229,7 +229,7 @@ static unsigned int speedstep_detect_chipset (void)
229 return 0; 229 return 0;
230} 230}
231 231
232static unsigned int _speedstep_get(const cpumask_t *cpus) 232static unsigned int _speedstep_get(const struct cpumask *cpus)
233{ 233{
234 unsigned int speed; 234 unsigned int speed;
235 cpumask_t cpus_allowed; 235 cpumask_t cpus_allowed;
@@ -244,7 +244,7 @@ static unsigned int _speedstep_get(const cpumask_t *cpus)
244 244
245static unsigned int speedstep_get(unsigned int cpu) 245static unsigned int speedstep_get(unsigned int cpu)
246{ 246{
247 return _speedstep_get(&cpumask_of_cpu(cpu)); 247 return _speedstep_get(cpumask_of(cpu));
248} 248}
249 249
250/** 250/**
@@ -267,7 +267,7 @@ static int speedstep_target (struct cpufreq_policy *policy,
267 if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate)) 267 if (cpufreq_frequency_table_target(policy, &speedstep_freqs[0], target_freq, relation, &newstate))
268 return -EINVAL; 268 return -EINVAL;
269 269
270 freqs.old = _speedstep_get(&policy->cpus); 270 freqs.old = _speedstep_get(policy->cpus);
271 freqs.new = speedstep_freqs[newstate].frequency; 271 freqs.new = speedstep_freqs[newstate].frequency;
272 freqs.cpu = policy->cpu; 272 freqs.cpu = policy->cpu;
273 273
@@ -279,20 +279,20 @@ static int speedstep_target (struct cpufreq_policy *policy,
279 279
280 cpus_allowed = current->cpus_allowed; 280 cpus_allowed = current->cpus_allowed;
281 281
282 for_each_cpu_mask_nr(i, policy->cpus) { 282 for_each_cpu(i, policy->cpus) {
283 freqs.cpu = i; 283 freqs.cpu = i;
284 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 284 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
285 } 285 }
286 286
287 /* switch to physical CPU where state is to be changed */ 287 /* switch to physical CPU where state is to be changed */
288 set_cpus_allowed_ptr(current, &policy->cpus); 288 set_cpus_allowed_ptr(current, policy->cpus);
289 289
290 speedstep_set_state(newstate); 290 speedstep_set_state(newstate);
291 291
292 /* allow to be run on all CPUs */ 292 /* allow to be run on all CPUs */
293 set_cpus_allowed_ptr(current, &cpus_allowed); 293 set_cpus_allowed_ptr(current, &cpus_allowed);
294 294
295 for_each_cpu_mask_nr(i, policy->cpus) { 295 for_each_cpu(i, policy->cpus) {
296 freqs.cpu = i; 296 freqs.cpu = i;
297 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 297 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
298 } 298 }
@@ -322,11 +322,11 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
322 322
323 /* only run on CPU to be set, or on its sibling */ 323 /* only run on CPU to be set, or on its sibling */
324#ifdef CONFIG_SMP 324#ifdef CONFIG_SMP
325 policy->cpus = per_cpu(cpu_sibling_map, policy->cpu); 325 cpumask_copy(policy->cpus, &per_cpu(cpu_sibling_map, policy->cpu));
326#endif 326#endif
327 327
328 cpus_allowed = current->cpus_allowed; 328 cpus_allowed = current->cpus_allowed;
329 set_cpus_allowed_ptr(current, &policy->cpus); 329 set_cpus_allowed_ptr(current, policy->cpus);
330 330
331 /* detect low and high frequency and transition latency */ 331 /* detect low and high frequency and transition latency */
332 result = speedstep_get_freqs(speedstep_processor, 332 result = speedstep_get_freqs(speedstep_processor,
@@ -339,7 +339,7 @@ static int speedstep_cpu_init(struct cpufreq_policy *policy)
339 return result; 339 return result;
340 340
341 /* get current speed setting */ 341 /* get current speed setting */
342 speed = _speedstep_get(&policy->cpus); 342 speed = _speedstep_get(policy->cpus);
343 if (!speed) 343 if (!speed)
344 return -EIO; 344 return -EIO;
345 345
diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 65a13943e098..e85826829cf2 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -665,6 +665,27 @@ void __init e820_mark_nosave_regions(unsigned long limit_pfn)
665} 665}
666#endif 666#endif
667 667
668#ifdef CONFIG_HIBERNATION
669/**
670 * Mark ACPI NVS memory region, so that we can save/restore it during
671 * hibernation and the subsequent resume.
672 */
673static int __init e820_mark_nvs_memory(void)
674{
675 int i;
676
677 for (i = 0; i < e820.nr_map; i++) {
678 struct e820entry *ei = &e820.map[i];
679
680 if (ei->type == E820_NVS)
681 hibernate_nvs_register(ei->addr, ei->size);
682 }
683
684 return 0;
685}
686core_initcall(e820_mark_nvs_memory);
687#endif
688
668/* 689/*
669 * Early reserved memory areas. 690 * Early reserved memory areas.
670 */ 691 */
diff --git a/arch/x86/kernel/early-quirks.c b/arch/x86/kernel/early-quirks.c
index 744aa7fc49d5..76b8cd953dee 100644
--- a/arch/x86/kernel/early-quirks.c
+++ b/arch/x86/kernel/early-quirks.c
@@ -201,6 +201,12 @@ struct chipset {
201 void (*f)(int num, int slot, int func); 201 void (*f)(int num, int slot, int func);
202}; 202};
203 203
204/*
205 * Only works for devices on the root bus. If you add any devices
206 * not on bus 0 readd another loop level in early_quirks(). But
207 * be careful because at least the Nvidia quirk here relies on
208 * only matching on bus 0.
209 */
204static struct chipset early_qrk[] __initdata = { 210static struct chipset early_qrk[] __initdata = {
205 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID, 211 { PCI_VENDOR_ID_NVIDIA, PCI_ANY_ID,
206 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs }, 212 PCI_CLASS_BRIDGE_PCI, PCI_ANY_ID, QFLAG_APPLY_ONCE, nvidia_bugs },
@@ -267,17 +273,17 @@ static int __init check_dev_quirk(int num, int slot, int func)
267 273
268void __init early_quirks(void) 274void __init early_quirks(void)
269{ 275{
270 int num, slot, func; 276 int slot, func;
271 277
272 if (!early_pci_allowed()) 278 if (!early_pci_allowed())
273 return; 279 return;
274 280
275 /* Poor man's PCI discovery */ 281 /* Poor man's PCI discovery */
276 for (num = 0; num < 32; num++) 282 /* Only scan the root bus */
277 for (slot = 0; slot < 32; slot++) 283 for (slot = 0; slot < 32; slot++)
278 for (func = 0; func < 8; func++) { 284 for (func = 0; func < 8; func++) {
279 /* Only probe function 0 on single fn devices */ 285 /* Only probe function 0 on single fn devices */
280 if (check_dev_quirk(num, slot, func)) 286 if (check_dev_quirk(0, slot, func))
281 break; 287 break;
282 } 288 }
283} 289}
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 6c27679ec6aa..884d985b8b82 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -376,9 +376,10 @@ void __kprobes arch_disarm_kprobe(struct kprobe *p)
376 376
377void __kprobes arch_remove_kprobe(struct kprobe *p) 377void __kprobes arch_remove_kprobe(struct kprobe *p)
378{ 378{
379 mutex_lock(&kprobe_mutex); 379 if (p->ainsn.insn) {
380 free_insn_slot(p->ainsn.insn, (p->ainsn.boostable == 1)); 380 free_insn_slot(p->ainsn.insn, (p->ainsn.boostable == 1));
381 mutex_unlock(&kprobe_mutex); 381 p->ainsn.insn = NULL;
382 }
382} 383}
383 384
384static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb) 385static void __kprobes save_previous_kprobe(struct kprobe_ctlblk *kcb)
@@ -694,7 +695,7 @@ static __used __kprobes void *trampoline_handler(struct pt_regs *regs)
694 /* 695 /*
695 * It is possible to have multiple instances associated with a given 696 * It is possible to have multiple instances associated with a given
696 * task either because multiple functions in the call path have 697 * task either because multiple functions in the call path have
697 * return probes installed on them, and/or more then one 698 * return probes installed on them, and/or more than one
698 * return probe was registered for a target function. 699 * return probe was registered for a target function.
699 * 700 *
700 * We can handle this because: 701 * We can handle this because:
diff --git a/arch/x86/kernel/mfgpt_32.c b/arch/x86/kernel/mfgpt_32.c
index c12314c9e86f..8815f3c7fec7 100644
--- a/arch/x86/kernel/mfgpt_32.c
+++ b/arch/x86/kernel/mfgpt_32.c
@@ -252,7 +252,7 @@ EXPORT_SYMBOL_GPL(geode_mfgpt_alloc_timer);
252/* 252/*
253 * The MFPGT timers on the CS5536 provide us with suitable timers to use 253 * The MFPGT timers on the CS5536 provide us with suitable timers to use
254 * as clock event sources - not as good as a HPET or APIC, but certainly 254 * as clock event sources - not as good as a HPET or APIC, but certainly
255 * better then the PIT. This isn't a general purpose MFGPT driver, but 255 * better than the PIT. This isn't a general purpose MFGPT driver, but
256 * a simplified one designed specifically to act as a clock event source. 256 * a simplified one designed specifically to act as a clock event source.
257 * For full details about the MFGPT, please consult the CS5536 data sheet. 257 * For full details about the MFGPT, please consult the CS5536 data sheet.
258 */ 258 */
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index 19a1044a0cd9..b25428533141 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -38,7 +38,7 @@ EXPORT_SYMBOL(bad_dma_address);
38 be probably a smaller DMA mask, but this is bug-to-bug compatible 38 be probably a smaller DMA mask, but this is bug-to-bug compatible
39 to older i386. */ 39 to older i386. */
40struct device x86_dma_fallback_dev = { 40struct device x86_dma_fallback_dev = {
41 .bus_id = "fallback device", 41 .init_name = "fallback device",
42 .coherent_dma_mask = DMA_32BIT_MASK, 42 .coherent_dma_mask = DMA_32BIT_MASK,
43 .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask, 43 .dma_mask = &x86_dma_fallback_dev.coherent_dma_mask,
44}; 44};
diff --git a/arch/x86/kernel/pci-swiotlb_64.c b/arch/x86/kernel/pci-swiotlb_64.c
index 8cba3749a511..d59c91747665 100644
--- a/arch/x86/kernel/pci-swiotlb_64.c
+++ b/arch/x86/kernel/pci-swiotlb_64.c
@@ -23,7 +23,7 @@ void *swiotlb_alloc(unsigned order, unsigned long nslabs)
23 return (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, order); 23 return (void *)__get_free_pages(GFP_DMA | __GFP_NOWARN, order);
24} 24}
25 25
26dma_addr_t swiotlb_phys_to_bus(phys_addr_t paddr) 26dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
27{ 27{
28 return paddr; 28 return paddr;
29} 29}
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index e4433bf44209..55c46074eba0 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -130,7 +130,27 @@ static void __init setup_cpu_pda_map(void)
130 /* point to new pointer table */ 130 /* point to new pointer table */
131 _cpu_pda = new_cpu_pda; 131 _cpu_pda = new_cpu_pda;
132} 132}
133#endif 133
134#endif /* CONFIG_SMP && CONFIG_X86_64 */
135
136#ifdef CONFIG_X86_64
137
138/* correctly size the local cpu masks */
139static void setup_cpu_local_masks(void)
140{
141 alloc_bootmem_cpumask_var(&cpu_initialized_mask);
142 alloc_bootmem_cpumask_var(&cpu_callin_mask);
143 alloc_bootmem_cpumask_var(&cpu_callout_mask);
144 alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
145}
146
147#else /* CONFIG_X86_32 */
148
149static inline void setup_cpu_local_masks(void)
150{
151}
152
153#endif /* CONFIG_X86_32 */
134 154
135/* 155/*
136 * Great future plan: 156 * Great future plan:
@@ -186,6 +206,9 @@ void __init setup_per_cpu_areas(void)
186 206
187 /* Setup node to cpumask map */ 207 /* Setup node to cpumask map */
188 setup_node_to_cpumask_map(); 208 setup_node_to_cpumask_map();
209
210 /* Setup cpu initialized, callin, callout masks */
211 setup_cpu_local_masks();
189} 212}
190 213
191#endif 214#endif
diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c
index cf1f075886b4..e6faa3316bd2 100644
--- a/arch/x86/kernel/smp.c
+++ b/arch/x86/kernel/smp.c
@@ -128,16 +128,23 @@ void native_send_call_func_single_ipi(int cpu)
128 128
129void native_send_call_func_ipi(const struct cpumask *mask) 129void native_send_call_func_ipi(const struct cpumask *mask)
130{ 130{
131 cpumask_t allbutself; 131 cpumask_var_t allbutself;
132 132
133 allbutself = cpu_online_map; 133 if (!alloc_cpumask_var(&allbutself, GFP_ATOMIC)) {
134 cpu_clear(smp_processor_id(), allbutself); 134 send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
135 return;
136 }
135 137
136 if (cpus_equal(*mask, allbutself) && 138 cpumask_copy(allbutself, cpu_online_mask);
137 cpus_equal(cpu_online_map, cpu_callout_map)) 139 cpumask_clear_cpu(smp_processor_id(), allbutself);
140
141 if (cpumask_equal(mask, allbutself) &&
142 cpumask_equal(cpu_online_mask, cpu_callout_mask))
138 send_IPI_allbutself(CALL_FUNCTION_VECTOR); 143 send_IPI_allbutself(CALL_FUNCTION_VECTOR);
139 else 144 else
140 send_IPI_mask(mask, CALL_FUNCTION_VECTOR); 145 send_IPI_mask(mask, CALL_FUNCTION_VECTOR);
146
147 free_cpumask_var(allbutself);
141} 148}
142 149
143/* 150/*
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index f8c885bed18c..6c2b8444b830 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -101,9 +101,6 @@ EXPORT_SYMBOL(smp_num_siblings);
101/* Last level cache ID of each logical CPU */ 101/* Last level cache ID of each logical CPU */
102DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID; 102DEFINE_PER_CPU(u16, cpu_llc_id) = BAD_APICID;
103 103
104cpumask_t cpu_callin_map;
105cpumask_t cpu_callout_map;
106
107/* representing HT siblings of each logical CPU */ 104/* representing HT siblings of each logical CPU */
108DEFINE_PER_CPU(cpumask_t, cpu_sibling_map); 105DEFINE_PER_CPU(cpumask_t, cpu_sibling_map);
109EXPORT_PER_CPU_SYMBOL(cpu_sibling_map); 106EXPORT_PER_CPU_SYMBOL(cpu_sibling_map);
@@ -119,9 +116,6 @@ EXPORT_PER_CPU_SYMBOL(cpu_info);
119static atomic_t init_deasserted; 116static atomic_t init_deasserted;
120 117
121 118
122/* representing cpus for which sibling maps can be computed */
123static cpumask_t cpu_sibling_setup_map;
124
125/* Set if we find a B stepping CPU */ 119/* Set if we find a B stepping CPU */
126static int __cpuinitdata smp_b_stepping; 120static int __cpuinitdata smp_b_stepping;
127 121
@@ -139,7 +133,7 @@ EXPORT_SYMBOL(cpu_to_node_map);
139static void map_cpu_to_node(int cpu, int node) 133static void map_cpu_to_node(int cpu, int node)
140{ 134{
141 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node); 135 printk(KERN_INFO "Mapping cpu %d to node %d\n", cpu, node);
142 cpu_set(cpu, node_to_cpumask_map[node]); 136 cpumask_set_cpu(cpu, &node_to_cpumask_map[node]);
143 cpu_to_node_map[cpu] = node; 137 cpu_to_node_map[cpu] = node;
144} 138}
145 139
@@ -150,7 +144,7 @@ static void unmap_cpu_to_node(int cpu)
150 144
151 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu); 145 printk(KERN_INFO "Unmapping cpu %d from all nodes\n", cpu);
152 for (node = 0; node < MAX_NUMNODES; node++) 146 for (node = 0; node < MAX_NUMNODES; node++)
153 cpu_clear(cpu, node_to_cpumask_map[node]); 147 cpumask_clear_cpu(cpu, &node_to_cpumask_map[node]);
154 cpu_to_node_map[cpu] = 0; 148 cpu_to_node_map[cpu] = 0;
155} 149}
156#else /* !(CONFIG_NUMA && CONFIG_X86_32) */ 150#else /* !(CONFIG_NUMA && CONFIG_X86_32) */
@@ -208,7 +202,7 @@ static void __cpuinit smp_callin(void)
208 */ 202 */
209 phys_id = read_apic_id(); 203 phys_id = read_apic_id();
210 cpuid = smp_processor_id(); 204 cpuid = smp_processor_id();
211 if (cpu_isset(cpuid, cpu_callin_map)) { 205 if (cpumask_test_cpu(cpuid, cpu_callin_mask)) {
212 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__, 206 panic("%s: phys CPU#%d, CPU#%d already present??\n", __func__,
213 phys_id, cpuid); 207 phys_id, cpuid);
214 } 208 }
@@ -230,7 +224,7 @@ static void __cpuinit smp_callin(void)
230 /* 224 /*
231 * Has the boot CPU finished it's STARTUP sequence? 225 * Has the boot CPU finished it's STARTUP sequence?
232 */ 226 */
233 if (cpu_isset(cpuid, cpu_callout_map)) 227 if (cpumask_test_cpu(cpuid, cpu_callout_mask))
234 break; 228 break;
235 cpu_relax(); 229 cpu_relax();
236 } 230 }
@@ -273,7 +267,7 @@ static void __cpuinit smp_callin(void)
273 /* 267 /*
274 * Allow the master to continue. 268 * Allow the master to continue.
275 */ 269 */
276 cpu_set(cpuid, cpu_callin_map); 270 cpumask_set_cpu(cpuid, cpu_callin_mask);
277} 271}
278 272
279static int __cpuinitdata unsafe_smp; 273static int __cpuinitdata unsafe_smp;
@@ -331,7 +325,7 @@ notrace static void __cpuinit start_secondary(void *unused)
331 ipi_call_lock(); 325 ipi_call_lock();
332 lock_vector_lock(); 326 lock_vector_lock();
333 __setup_vector_irq(smp_processor_id()); 327 __setup_vector_irq(smp_processor_id());
334 cpu_set(smp_processor_id(), cpu_online_map); 328 set_cpu_online(smp_processor_id(), true);
335 unlock_vector_lock(); 329 unlock_vector_lock();
336 ipi_call_unlock(); 330 ipi_call_unlock();
337 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE; 331 per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;
@@ -437,50 +431,52 @@ void __cpuinit set_cpu_sibling_map(int cpu)
437 int i; 431 int i;
438 struct cpuinfo_x86 *c = &cpu_data(cpu); 432 struct cpuinfo_x86 *c = &cpu_data(cpu);
439 433
440 cpu_set(cpu, cpu_sibling_setup_map); 434 cpumask_set_cpu(cpu, cpu_sibling_setup_mask);
441 435
442 if (smp_num_siblings > 1) { 436 if (smp_num_siblings > 1) {
443 for_each_cpu_mask_nr(i, cpu_sibling_setup_map) { 437 for_each_cpu(i, cpu_sibling_setup_mask) {
444 if (c->phys_proc_id == cpu_data(i).phys_proc_id && 438 struct cpuinfo_x86 *o = &cpu_data(i);
445 c->cpu_core_id == cpu_data(i).cpu_core_id) { 439
446 cpu_set(i, per_cpu(cpu_sibling_map, cpu)); 440 if (c->phys_proc_id == o->phys_proc_id &&
447 cpu_set(cpu, per_cpu(cpu_sibling_map, i)); 441 c->cpu_core_id == o->cpu_core_id) {
448 cpu_set(i, per_cpu(cpu_core_map, cpu)); 442 cpumask_set_cpu(i, cpu_sibling_mask(cpu));
449 cpu_set(cpu, per_cpu(cpu_core_map, i)); 443 cpumask_set_cpu(cpu, cpu_sibling_mask(i));
450 cpu_set(i, c->llc_shared_map); 444 cpumask_set_cpu(i, cpu_core_mask(cpu));
451 cpu_set(cpu, cpu_data(i).llc_shared_map); 445 cpumask_set_cpu(cpu, cpu_core_mask(i));
446 cpumask_set_cpu(i, &c->llc_shared_map);
447 cpumask_set_cpu(cpu, &o->llc_shared_map);
452 } 448 }
453 } 449 }
454 } else { 450 } else {
455 cpu_set(cpu, per_cpu(cpu_sibling_map, cpu)); 451 cpumask_set_cpu(cpu, cpu_sibling_mask(cpu));
456 } 452 }
457 453
458 cpu_set(cpu, c->llc_shared_map); 454 cpumask_set_cpu(cpu, &c->llc_shared_map);
459 455
460 if (current_cpu_data.x86_max_cores == 1) { 456 if (current_cpu_data.x86_max_cores == 1) {
461 per_cpu(cpu_core_map, cpu) = per_cpu(cpu_sibling_map, cpu); 457 cpumask_copy(cpu_core_mask(cpu), cpu_sibling_mask(cpu));
462 c->booted_cores = 1; 458 c->booted_cores = 1;
463 return; 459 return;
464 } 460 }
465 461
466 for_each_cpu_mask_nr(i, cpu_sibling_setup_map) { 462 for_each_cpu(i, cpu_sibling_setup_mask) {
467 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID && 463 if (per_cpu(cpu_llc_id, cpu) != BAD_APICID &&
468 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) { 464 per_cpu(cpu_llc_id, cpu) == per_cpu(cpu_llc_id, i)) {
469 cpu_set(i, c->llc_shared_map); 465 cpumask_set_cpu(i, &c->llc_shared_map);
470 cpu_set(cpu, cpu_data(i).llc_shared_map); 466 cpumask_set_cpu(cpu, &cpu_data(i).llc_shared_map);
471 } 467 }
472 if (c->phys_proc_id == cpu_data(i).phys_proc_id) { 468 if (c->phys_proc_id == cpu_data(i).phys_proc_id) {
473 cpu_set(i, per_cpu(cpu_core_map, cpu)); 469 cpumask_set_cpu(i, cpu_core_mask(cpu));
474 cpu_set(cpu, per_cpu(cpu_core_map, i)); 470 cpumask_set_cpu(cpu, cpu_core_mask(i));
475 /* 471 /*
476 * Does this new cpu bringup a new core? 472 * Does this new cpu bringup a new core?
477 */ 473 */
478 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) { 474 if (cpumask_weight(cpu_sibling_mask(cpu)) == 1) {
479 /* 475 /*
480 * for each core in package, increment 476 * for each core in package, increment
481 * the booted_cores for this new cpu 477 * the booted_cores for this new cpu
482 */ 478 */
483 if (first_cpu(per_cpu(cpu_sibling_map, i)) == i) 479 if (cpumask_first(cpu_sibling_mask(i)) == i)
484 c->booted_cores++; 480 c->booted_cores++;
485 /* 481 /*
486 * increment the core count for all 482 * increment the core count for all
@@ -503,7 +499,7 @@ const struct cpumask *cpu_coregroup_mask(int cpu)
503 * And for power savings, we return cpu_core_map 499 * And for power savings, we return cpu_core_map
504 */ 500 */
505 if (sched_mc_power_savings || sched_smt_power_savings) 501 if (sched_mc_power_savings || sched_smt_power_savings)
506 return &per_cpu(cpu_core_map, cpu); 502 return cpu_core_mask(cpu);
507 else 503 else
508 return &c->llc_shared_map; 504 return &c->llc_shared_map;
509} 505}
@@ -522,7 +518,7 @@ static void impress_friends(void)
522 */ 518 */
523 pr_debug("Before bogomips.\n"); 519 pr_debug("Before bogomips.\n");
524 for_each_possible_cpu(cpu) 520 for_each_possible_cpu(cpu)
525 if (cpu_isset(cpu, cpu_callout_map)) 521 if (cpumask_test_cpu(cpu, cpu_callout_mask))
526 bogosum += cpu_data(cpu).loops_per_jiffy; 522 bogosum += cpu_data(cpu).loops_per_jiffy;
527 printk(KERN_INFO 523 printk(KERN_INFO
528 "Total of %d processors activated (%lu.%02lu BogoMIPS).\n", 524 "Total of %d processors activated (%lu.%02lu BogoMIPS).\n",
@@ -903,19 +899,19 @@ do_rest:
903 * allow APs to start initializing. 899 * allow APs to start initializing.
904 */ 900 */
905 pr_debug("Before Callout %d.\n", cpu); 901 pr_debug("Before Callout %d.\n", cpu);
906 cpu_set(cpu, cpu_callout_map); 902 cpumask_set_cpu(cpu, cpu_callout_mask);
907 pr_debug("After Callout %d.\n", cpu); 903 pr_debug("After Callout %d.\n", cpu);
908 904
909 /* 905 /*
910 * Wait 5s total for a response 906 * Wait 5s total for a response
911 */ 907 */
912 for (timeout = 0; timeout < 50000; timeout++) { 908 for (timeout = 0; timeout < 50000; timeout++) {
913 if (cpu_isset(cpu, cpu_callin_map)) 909 if (cpumask_test_cpu(cpu, cpu_callin_mask))
914 break; /* It has booted */ 910 break; /* It has booted */
915 udelay(100); 911 udelay(100);
916 } 912 }
917 913
918 if (cpu_isset(cpu, cpu_callin_map)) { 914 if (cpumask_test_cpu(cpu, cpu_callin_mask)) {
919 /* number CPUs logically, starting from 1 (BSP is 0) */ 915 /* number CPUs logically, starting from 1 (BSP is 0) */
920 pr_debug("OK.\n"); 916 pr_debug("OK.\n");
921 printk(KERN_INFO "CPU%d: ", cpu); 917 printk(KERN_INFO "CPU%d: ", cpu);
@@ -940,9 +936,14 @@ restore_state:
940 if (boot_error) { 936 if (boot_error) {
941 /* Try to put things back the way they were before ... */ 937 /* Try to put things back the way they were before ... */
942 numa_remove_cpu(cpu); /* was set by numa_add_cpu */ 938 numa_remove_cpu(cpu); /* was set by numa_add_cpu */
943 cpu_clear(cpu, cpu_callout_map); /* was set by do_boot_cpu() */ 939
944 cpu_clear(cpu, cpu_initialized); /* was set by cpu_init() */ 940 /* was set by do_boot_cpu() */
945 cpu_clear(cpu, cpu_present_map); 941 cpumask_clear_cpu(cpu, cpu_callout_mask);
942
943 /* was set by cpu_init() */
944 cpumask_clear_cpu(cpu, cpu_initialized_mask);
945
946 set_cpu_present(cpu, false);
946 per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID; 947 per_cpu(x86_cpu_to_apicid, cpu) = BAD_APICID;
947 } 948 }
948 949
@@ -976,7 +977,7 @@ int __cpuinit native_cpu_up(unsigned int cpu)
976 /* 977 /*
977 * Already booted CPU? 978 * Already booted CPU?
978 */ 979 */
979 if (cpu_isset(cpu, cpu_callin_map)) { 980 if (cpumask_test_cpu(cpu, cpu_callin_mask)) {
980 pr_debug("do_boot_cpu %d Already started\n", cpu); 981 pr_debug("do_boot_cpu %d Already started\n", cpu);
981 return -ENOSYS; 982 return -ENOSYS;
982 } 983 }
@@ -1031,8 +1032,9 @@ int __cpuinit native_cpu_up(unsigned int cpu)
1031 */ 1032 */
1032static __init void disable_smp(void) 1033static __init void disable_smp(void)
1033{ 1034{
1034 cpu_present_map = cpumask_of_cpu(0); 1035 /* use the read/write pointers to the present and possible maps */
1035 cpu_possible_map = cpumask_of_cpu(0); 1036 cpumask_copy(&cpu_present_map, cpumask_of(0));
1037 cpumask_copy(&cpu_possible_map, cpumask_of(0));
1036 smpboot_clear_io_apic_irqs(); 1038 smpboot_clear_io_apic_irqs();
1037 1039
1038 if (smp_found_config) 1040 if (smp_found_config)
@@ -1040,8 +1042,8 @@ static __init void disable_smp(void)
1040 else 1042 else
1041 physid_set_mask_of_physid(0, &phys_cpu_present_map); 1043 physid_set_mask_of_physid(0, &phys_cpu_present_map);
1042 map_cpu_to_logical_apicid(); 1044 map_cpu_to_logical_apicid();
1043 cpu_set(0, per_cpu(cpu_sibling_map, 0)); 1045 cpumask_set_cpu(0, cpu_sibling_mask(0));
1044 cpu_set(0, per_cpu(cpu_core_map, 0)); 1046 cpumask_set_cpu(0, cpu_core_mask(0));
1045} 1047}
1046 1048
1047/* 1049/*
@@ -1063,14 +1065,14 @@ static int __init smp_sanity_check(unsigned max_cpus)
1063 nr = 0; 1065 nr = 0;
1064 for_each_present_cpu(cpu) { 1066 for_each_present_cpu(cpu) {
1065 if (nr >= 8) 1067 if (nr >= 8)
1066 cpu_clear(cpu, cpu_present_map); 1068 set_cpu_present(cpu, false);
1067 nr++; 1069 nr++;
1068 } 1070 }
1069 1071
1070 nr = 0; 1072 nr = 0;
1071 for_each_possible_cpu(cpu) { 1073 for_each_possible_cpu(cpu) {
1072 if (nr >= 8) 1074 if (nr >= 8)
1073 cpu_clear(cpu, cpu_possible_map); 1075 set_cpu_possible(cpu, false);
1074 nr++; 1076 nr++;
1075 } 1077 }
1076 1078
@@ -1166,7 +1168,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
1166 preempt_disable(); 1168 preempt_disable();
1167 smp_cpu_index_default(); 1169 smp_cpu_index_default();
1168 current_cpu_data = boot_cpu_data; 1170 current_cpu_data = boot_cpu_data;
1169 cpu_callin_map = cpumask_of_cpu(0); 1171 cpumask_copy(cpu_callin_mask, cpumask_of(0));
1170 mb(); 1172 mb();
1171 /* 1173 /*
1172 * Setup boot CPU information 1174 * Setup boot CPU information
@@ -1241,8 +1243,8 @@ void __init native_smp_prepare_boot_cpu(void)
1241 init_gdt(me); 1243 init_gdt(me);
1242#endif 1244#endif
1243 switch_to_new_gdt(); 1245 switch_to_new_gdt();
1244 /* already set me in cpu_online_map in boot_cpu_init() */ 1246 /* already set me in cpu_online_mask in boot_cpu_init() */
1245 cpu_set(me, cpu_callout_map); 1247 cpumask_set_cpu(me, cpu_callout_mask);
1246 per_cpu(cpu_state, me) = CPU_ONLINE; 1248 per_cpu(cpu_state, me) = CPU_ONLINE;
1247} 1249}
1248 1250
@@ -1310,7 +1312,7 @@ __init void prefill_possible_map(void)
1310 possible, max_t(int, possible - num_processors, 0)); 1312 possible, max_t(int, possible - num_processors, 0));
1311 1313
1312 for (i = 0; i < possible; i++) 1314 for (i = 0; i < possible; i++)
1313 cpu_set(i, cpu_possible_map); 1315 set_cpu_possible(i, true);
1314 1316
1315 nr_cpu_ids = possible; 1317 nr_cpu_ids = possible;
1316} 1318}
@@ -1322,31 +1324,31 @@ static void remove_siblinginfo(int cpu)
1322 int sibling; 1324 int sibling;
1323 struct cpuinfo_x86 *c = &cpu_data(cpu); 1325 struct cpuinfo_x86 *c = &cpu_data(cpu);
1324 1326
1325 for_each_cpu_mask_nr(sibling, per_cpu(cpu_core_map, cpu)) { 1327 for_each_cpu(sibling, cpu_core_mask(cpu)) {
1326 cpu_clear(cpu, per_cpu(cpu_core_map, sibling)); 1328 cpumask_clear_cpu(cpu, cpu_core_mask(sibling));
1327 /*/ 1329 /*/
1328 * last thread sibling in this cpu core going down 1330 * last thread sibling in this cpu core going down
1329 */ 1331 */
1330 if (cpus_weight(per_cpu(cpu_sibling_map, cpu)) == 1) 1332 if (cpumask_weight(cpu_sibling_mask(cpu)) == 1)
1331 cpu_data(sibling).booted_cores--; 1333 cpu_data(sibling).booted_cores--;
1332 } 1334 }
1333 1335
1334 for_each_cpu_mask_nr(sibling, per_cpu(cpu_sibling_map, cpu)) 1336 for_each_cpu(sibling, cpu_sibling_mask(cpu))
1335 cpu_clear(cpu, per_cpu(cpu_sibling_map, sibling)); 1337 cpumask_clear_cpu(cpu, cpu_sibling_mask(sibling));
1336 cpus_clear(per_cpu(cpu_sibling_map, cpu)); 1338 cpumask_clear(cpu_sibling_mask(cpu));
1337 cpus_clear(per_cpu(cpu_core_map, cpu)); 1339 cpumask_clear(cpu_core_mask(cpu));
1338 c->phys_proc_id = 0; 1340 c->phys_proc_id = 0;
1339 c->cpu_core_id = 0; 1341 c->cpu_core_id = 0;
1340 cpu_clear(cpu, cpu_sibling_setup_map); 1342 cpumask_clear_cpu(cpu, cpu_sibling_setup_mask);
1341} 1343}
1342 1344
1343static void __ref remove_cpu_from_maps(int cpu) 1345static void __ref remove_cpu_from_maps(int cpu)
1344{ 1346{
1345 cpu_clear(cpu, cpu_online_map); 1347 set_cpu_online(cpu, false);
1346 cpu_clear(cpu, cpu_callout_map); 1348 cpumask_clear_cpu(cpu, cpu_callout_mask);
1347 cpu_clear(cpu, cpu_callin_map); 1349 cpumask_clear_cpu(cpu, cpu_callin_mask);
1348 /* was set by cpu_init() */ 1350 /* was set by cpu_init() */
1349 cpu_clear(cpu, cpu_initialized); 1351 cpumask_clear_cpu(cpu, cpu_initialized_mask);
1350 numa_remove_cpu(cpu); 1352 numa_remove_cpu(cpu);
1351} 1353}
1352 1354
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 25d5c3073582..98c2d055284b 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -20,7 +20,6 @@
20#include <linux/module.h> 20#include <linux/module.h>
21#include <linux/ptrace.h> 21#include <linux/ptrace.h>
22#include <linux/string.h> 22#include <linux/string.h>
23#include <linux/unwind.h>
24#include <linux/delay.h> 23#include <linux/delay.h>
25#include <linux/errno.h> 24#include <linux/errno.h>
26#include <linux/kexec.h> 25#include <linux/kexec.h>
@@ -51,7 +50,6 @@
51#include <asm/debugreg.h> 50#include <asm/debugreg.h>
52#include <asm/atomic.h> 51#include <asm/atomic.h>
53#include <asm/system.h> 52#include <asm/system.h>
54#include <asm/unwind.h>
55#include <asm/traps.h> 53#include <asm/traps.h>
56#include <asm/desc.h> 54#include <asm/desc.h>
57#include <asm/i387.h> 55#include <asm/i387.h>