blob: b5c35af2011d0325a2f3b3d331362d20b8dda41f [file] [log] [blame]
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -03001#include <linux/kernel.h>
2#include <linux/module.h>
3#include <linux/init.h>
4#include <linux/bootmem.h>
5#include <linux/percpu.h>
Bernhard Walle1ecd2762008-06-20 15:38:22 +02006#include <linux/kexec.h>
Yinghai Lu17b4cce2008-06-21 21:02:20 -07007#include <linux/crash_dump.h>
Jaswinder Singh Rajput8a87dd92009-01-04 17:04:26 +05308#include <linux/smp.h>
9#include <linux/topology.h>
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -030010#include <asm/sections.h>
11#include <asm/processor.h>
12#include <asm/setup.h>
Alexey Starikovskiy0fc09062008-04-04 23:40:48 +040013#include <asm/mpspec.h>
Alexey Starikovskiy76eb4132008-04-04 23:40:41 +040014#include <asm/apicdef.h>
Bernhard Walle1ecd2762008-06-20 15:38:22 +020015#include <asm/highmem.h>
Tejun Heo1a51e3a2009-01-13 20:41:35 +090016#include <asm/proto.h>
Jaswinder Singh Rajput06879032009-01-10 12:17:37 +053017#include <asm/cpumask.h>
Alexey Starikovskiy76eb4132008-04-04 23:40:41 +040018
Mike Travisc90aa892009-01-13 20:41:34 +090019#ifdef CONFIG_DEBUG_PER_CPU_MAPS
20# define DBG(x...) printk(KERN_DEBUG x)
21#else
22# define DBG(x...)
23#endif
24
James Bottomleyf8955eb2008-05-10 09:01:48 -050025#ifdef CONFIG_X86_LOCAL_APIC
Alexey Starikovskiy2fe60142008-04-04 23:41:44 +040026unsigned int num_processors;
27unsigned disabled_cpus __cpuinitdata;
28/* Processor that is doing the boot up */
29unsigned int boot_cpu_physical_apicid = -1U;
30EXPORT_SYMBOL(boot_cpu_physical_apicid);
Jaswinder Singh Rajput8a87dd92009-01-04 17:04:26 +053031unsigned int max_physical_apicid;
Alexey Starikovskiy2fe60142008-04-04 23:41:44 +040032
Alexey Starikovskiy0fc09062008-04-04 23:40:48 +040033/* Bitmask of physically existing CPUs */
34physid_mask_t phys_cpu_present_map;
James Bottomleyf8955eb2008-05-10 09:01:48 -050035#endif
Alexey Starikovskiy0fc09062008-04-04 23:40:48 +040036
Mike Travisc90aa892009-01-13 20:41:34 +090037/*
38 * Map cpu index to physical APIC ID
39 */
Mike Travis23ca4bb2008-05-12 21:21:12 +020040DEFINE_EARLY_PER_CPU(u16, x86_cpu_to_apicid, BAD_APICID);
41DEFINE_EARLY_PER_CPU(u16, x86_bios_cpu_apicid, BAD_APICID);
42EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_apicid);
43EXPORT_EARLY_PER_CPU_SYMBOL(x86_bios_cpu_apicid);
44
45#if defined(CONFIG_NUMA) && defined(CONFIG_X86_64)
Mike Travisc90aa892009-01-13 20:41:34 +090046#define X86_64_NUMA 1 /* (used later) */
Mike Travis23ca4bb2008-05-12 21:21:12 +020047
Mike Travisc90aa892009-01-13 20:41:34 +090048/*
49 * Map cpu index to node index
50 */
Mike Travis23ca4bb2008-05-12 21:21:12 +020051DEFINE_EARLY_PER_CPU(int, x86_cpu_to_node_map, NUMA_NO_NODE);
52EXPORT_EARLY_PER_CPU_SYMBOL(x86_cpu_to_node_map);
Mike Travis9f248bd2008-05-12 21:21:12 +020053
Mike Travisc90aa892009-01-13 20:41:34 +090054/*
55 * Which logical CPUs are on which nodes
56 */
Mike Travis9f248bd2008-05-12 21:21:12 +020057cpumask_t *node_to_cpumask_map;
58EXPORT_SYMBOL(node_to_cpumask_map);
59
Mike Travisc90aa892009-01-13 20:41:34 +090060/*
61 * Setup node_to_cpumask_map
62 */
Mike Travis9f248bd2008-05-12 21:21:12 +020063static void __init setup_node_to_cpumask_map(void);
64
65#else
66static inline void setup_node_to_cpumask_map(void) { }
Mike Travis23ca4bb2008-05-12 21:21:12 +020067#endif
68
Tejun Heob12d8db2009-01-13 20:41:35 +090069/*
70 * Define load_pda_offset() and per-cpu __pda for x86_64.
71 * load_pda_offset() is responsible for loading the offset of pda into
72 * %gs.
73 *
74 * On SMP, pda offset also duals as percpu base address and thus it
75 * should be at the start of per-cpu area. To achieve this, it's
76 * preallocated in vmlinux_64.lds.S directly instead of using
77 * DEFINE_PER_CPU().
78 */
Tejun Heo1a51e3a2009-01-13 20:41:35 +090079#ifdef CONFIG_X86_64
80void __cpuinit load_pda_offset(int cpu)
81{
82 /* Memory clobbers used to order pda/percpu accesses */
83 mb();
84 wrmsrl(MSR_GS_BASE, cpu_pda(cpu));
85 mb();
86}
Tejun Heob12d8db2009-01-13 20:41:35 +090087#ifndef CONFIG_SMP
88DEFINE_PER_CPU(struct x8664_pda, __pda);
Tejun Heob12d8db2009-01-13 20:41:35 +090089#endif
Tejun Heoa338af22009-01-16 11:19:03 +090090EXPORT_PER_CPU_SYMBOL(__pda);
Tejun Heo1a51e3a2009-01-13 20:41:35 +090091#endif /* CONFIG_SMP && CONFIG_X86_64 */
92
93#ifdef CONFIG_X86_64
94
95/* correctly size the local cpu masks */
96static void setup_cpu_local_masks(void)
97{
98 alloc_bootmem_cpumask_var(&cpu_initialized_mask);
99 alloc_bootmem_cpumask_var(&cpu_callin_mask);
100 alloc_bootmem_cpumask_var(&cpu_callout_mask);
101 alloc_bootmem_cpumask_var(&cpu_sibling_setup_mask);
102}
103
104#else /* CONFIG_X86_32 */
105
106static inline void setup_cpu_local_masks(void)
107{
108}
109
110#endif /* CONFIG_X86_32 */
111
Mike Travisc90aa892009-01-13 20:41:34 +0900112#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300113/*
114 * Copy data used in early init routines from the initial arrays to the
115 * per cpu data areas. These arrays then become expendable and the
116 * *_early_ptr's are zeroed indicating that the static arrays are gone.
117 */
118static void __init setup_per_cpu_maps(void)
119{
120 int cpu;
121
122 for_each_possible_cpu(cpu) {
Mike Travis23ca4bb2008-05-12 21:21:12 +0200123 per_cpu(x86_cpu_to_apicid, cpu) =
124 early_per_cpu_map(x86_cpu_to_apicid, cpu);
Mike Travisb447a462008-03-25 15:06:51 -0700125 per_cpu(x86_bios_cpu_apicid, cpu) =
Mike Travis23ca4bb2008-05-12 21:21:12 +0200126 early_per_cpu_map(x86_bios_cpu_apicid, cpu);
127#ifdef X86_64_NUMA
Mike Travisb447a462008-03-25 15:06:51 -0700128 per_cpu(x86_cpu_to_node_map, cpu) =
Mike Travis23ca4bb2008-05-12 21:21:12 +0200129 early_per_cpu_map(x86_cpu_to_node_map, cpu);
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300130#endif
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300131 }
132
133 /* indicate the early static arrays will soon be gone */
Mike Travis23ca4bb2008-05-12 21:21:12 +0200134 early_per_cpu_ptr(x86_cpu_to_apicid) = NULL;
135 early_per_cpu_ptr(x86_bios_cpu_apicid) = NULL;
136#ifdef X86_64_NUMA
137 early_per_cpu_ptr(x86_cpu_to_node_map) = NULL;
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300138#endif
139}
140
Tejun Heo9939dda2009-01-13 20:41:35 +0900141#ifdef CONFIG_X86_64
142unsigned long __per_cpu_offset[NR_CPUS] __read_mostly = {
143 [0] = (unsigned long)__per_cpu_load,
144};
145#else
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300146unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
Tejun Heo1a51e3a2009-01-13 20:41:35 +0900147#endif
Tejun Heo9939dda2009-01-13 20:41:35 +0900148EXPORT_SYMBOL(__per_cpu_offset);
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300149
150/*
151 * Great future plan:
152 * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
153 * Always point %gs to its beginning
154 */
155void __init setup_per_cpu_areas(void)
156{
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200157 ssize_t size, old_size;
Mike Travis3461b0a2008-05-12 21:21:13 +0200158 char *ptr;
159 int cpu;
Yinghai Lu1f8ff032008-08-19 20:49:45 -0700160 unsigned long align = 1;
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300161
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300162 /* Copy section for each CPU (we discard the original) */
Yinghai Lu1f3fcd42008-08-19 20:49:44 -0700163 old_size = PERCPU_ENOUGH_ROOM;
Yinghai Lu1f8ff032008-08-19 20:49:45 -0700164 align = max_t(unsigned long, PAGE_SIZE, align);
Thomas Gleixnerd6c88a52008-10-15 15:27:23 +0200165 size = roundup(old_size, align);
Mike Travisa1681962008-12-16 17:33:53 -0800166
Cyrill Gorcunovab143982009-01-02 21:51:32 +0300167 pr_info("NR_CPUS:%d nr_cpumask_bits:%d nr_cpu_ids:%d nr_node_ids:%d\n",
Mike Travisa1681962008-12-16 17:33:53 -0800168 NR_CPUS, nr_cpumask_bits, nr_cpu_ids, nr_node_ids);
169
Cyrill Gorcunovab143982009-01-02 21:51:32 +0300170 pr_info("PERCPU: Allocating %zd bytes of per cpu data\n", size);
Mike Travisb447a462008-03-25 15:06:51 -0700171
Mike Travis3461b0a2008-05-12 21:21:13 +0200172 for_each_possible_cpu(cpu) {
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300173#ifndef CONFIG_NEED_MULTIPLE_NODES
Yinghai Lu1f8ff032008-08-19 20:49:45 -0700174 ptr = __alloc_bootmem(size, align,
175 __pa(MAX_DMA_ADDRESS));
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300176#else
Mike Travis3461b0a2008-05-12 21:21:13 +0200177 int node = early_cpu_to_node(cpu);
Mike Travisb447a462008-03-25 15:06:51 -0700178 if (!node_online(node) || !NODE_DATA(node)) {
Yinghai Lu1f8ff032008-08-19 20:49:45 -0700179 ptr = __alloc_bootmem(size, align,
180 __pa(MAX_DMA_ADDRESS));
Cyrill Gorcunovab143982009-01-02 21:51:32 +0300181 pr_info("cpu %d has no node %d or node-local memory\n",
Mike Travis3461b0a2008-05-12 21:21:13 +0200182 cpu, node);
Cyrill Gorcunovab143982009-01-02 21:51:32 +0300183 pr_debug("per cpu data for cpu%d at %016lx\n",
184 cpu, __pa(ptr));
185 } else {
Yinghai Lu1f8ff032008-08-19 20:49:45 -0700186 ptr = __alloc_bootmem_node(NODE_DATA(node), size, align,
187 __pa(MAX_DMA_ADDRESS));
Cyrill Gorcunovab143982009-01-02 21:51:32 +0300188 pr_debug("per cpu data for cpu%d on node%d at %016lx\n",
189 cpu, node, __pa(ptr));
Yinghai Lua677f582008-07-29 00:37:10 -0700190 }
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300191#endif
Tejun Heo1a51e3a2009-01-13 20:41:35 +0900192
Tejun Heo3e5d8f92009-01-13 20:41:35 +0900193 memcpy(ptr, __per_cpu_load, __per_cpu_end - __per_cpu_start);
Tejun Heo9939dda2009-01-13 20:41:35 +0900194 per_cpu_offset(cpu) = ptr - __per_cpu_start;
Tejun Heo1a51e3a2009-01-13 20:41:35 +0900195#ifdef CONFIG_X86_64
Tejun Heo1a51e3a2009-01-13 20:41:35 +0900196 /*
197 * CPU0 modified pda in the init data area, reload pda
198 * offset for CPU0 and clear the area for others.
199 */
200 if (cpu == 0)
201 load_pda_offset(0);
202 else
203 memset(cpu_pda(cpu), 0, sizeof(*cpu_pda(cpu)));
204#endif
Tejun Heo9939dda2009-01-13 20:41:35 +0900205 per_cpu(this_cpu_off, cpu) = per_cpu_offset(cpu);
Mike Travisc90aa892009-01-13 20:41:34 +0900206
207 DBG("PERCPU: cpu %4d %p\n", cpu, ptr);
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300208 }
209
Mike Travisb447a462008-03-25 15:06:51 -0700210 /* Setup percpu data maps */
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300211 setup_per_cpu_maps();
Mike Travis9f0e8d02008-04-04 18:11:01 -0700212
Mike Travis9f248bd2008-05-12 21:21:12 +0200213 /* Setup node to cpumask map */
214 setup_node_to_cpumask_map();
Mike Travisc2d1cec2009-01-04 05:18:03 -0800215
216 /* Setup cpu initialized, callin, callout masks */
217 setup_cpu_local_masks();
Glauber de Oliveira Costa4fe29a82008-03-19 14:25:23 -0300218}
219
220#endif
Huang, Yingc45a7072008-06-02 14:26:25 +0800221
Mike Travis23ca4bb2008-05-12 21:21:12 +0200222#ifdef X86_64_NUMA
Mike Travis9f248bd2008-05-12 21:21:12 +0200223
224/*
225 * Allocate node_to_cpumask_map based on number of available nodes
226 * Requires node_possible_map to be valid.
227 *
228 * Note: node_to_cpumask() is not valid until after this is done.
Mike Travisc90aa892009-01-13 20:41:34 +0900229 * (Use CONFIG_DEBUG_PER_CPU_MAPS to check this.)
Mike Travis9f248bd2008-05-12 21:21:12 +0200230 */
231static void __init setup_node_to_cpumask_map(void)
232{
233 unsigned int node, num = 0;
234 cpumask_t *map;
235
236 /* setup nr_node_ids if not done yet */
237 if (nr_node_ids == MAX_NUMNODES) {
238 for_each_node_mask(node, node_possible_map)
239 num = node;
240 nr_node_ids = num + 1;
241 }
242
243 /* allocate the map */
244 map = alloc_bootmem_low(nr_node_ids * sizeof(cpumask_t));
Mike Travisc90aa892009-01-13 20:41:34 +0900245 DBG("node_to_cpumask_map at %p for %d nodes\n", map, nr_node_ids);
Mike Travis9f248bd2008-05-12 21:21:12 +0200246
Gustavo F. Padovan55410792008-10-15 10:37:04 -0300247 pr_debug("Node to cpumask map at %p for %d nodes\n",
Thomas Gleixnercfc1b9a2008-07-21 21:35:38 +0200248 map, nr_node_ids);
Mike Travis9f248bd2008-05-12 21:21:12 +0200249
250 /* node_to_cpumask() will now work */
251 node_to_cpumask_map = map;
252}
253
Mike Travis23ca4bb2008-05-12 21:21:12 +0200254void __cpuinit numa_set_node(int cpu, int node)
255{
256 int *cpu_to_node_map = early_per_cpu_ptr(x86_cpu_to_node_map);
257
Mike Travisc90aa892009-01-13 20:41:34 +0900258 /* early setting, no percpu area yet */
259 if (cpu_to_node_map) {
Mike Travis23ca4bb2008-05-12 21:21:12 +0200260 cpu_to_node_map[cpu] = node;
Mike Travisc90aa892009-01-13 20:41:34 +0900261 return;
262 }
Mike Travis23ca4bb2008-05-12 21:21:12 +0200263
Mike Travisc90aa892009-01-13 20:41:34 +0900264#ifdef CONFIG_DEBUG_PER_CPU_MAPS
265 if (cpu >= nr_cpu_ids || !per_cpu_offset(cpu)) {
266 printk(KERN_ERR "numa_set_node: invalid cpu# (%d)\n", cpu);
267 dump_stack();
268 return;
269 }
270#endif
271 per_cpu(x86_cpu_to_node_map, cpu) = node;
Mike Travis23ca4bb2008-05-12 21:21:12 +0200272
Mike Travisc90aa892009-01-13 20:41:34 +0900273 if (node != NUMA_NO_NODE)
274 cpu_pda(cpu)->nodenumber = node;
Mike Travis23ca4bb2008-05-12 21:21:12 +0200275}
276
277void __cpuinit numa_clear_node(int cpu)
278{
279 numa_set_node(cpu, NUMA_NO_NODE);
280}
281
Mike Travis9f248bd2008-05-12 21:21:12 +0200282#ifndef CONFIG_DEBUG_PER_CPU_MAPS
283
Mike Travis23ca4bb2008-05-12 21:21:12 +0200284void __cpuinit numa_add_cpu(int cpu)
285{
286 cpu_set(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
287}
288
289void __cpuinit numa_remove_cpu(int cpu)
290{
Mike Travisc90aa892009-01-13 20:41:34 +0900291 cpu_clear(cpu, node_to_cpumask_map[early_cpu_to_node(cpu)]);
Mike Travis23ca4bb2008-05-12 21:21:12 +0200292}
Mike Travis23ca4bb2008-05-12 21:21:12 +0200293
Mike Travis9f248bd2008-05-12 21:21:12 +0200294#else /* CONFIG_DEBUG_PER_CPU_MAPS */
295
296/*
297 * --------- debug versions of the numa functions ---------
298 */
299static void __cpuinit numa_set_cpumask(int cpu, int enable)
300{
Mike Travisc90aa892009-01-13 20:41:34 +0900301 int node = early_cpu_to_node(cpu);
Mike Travis9f248bd2008-05-12 21:21:12 +0200302 cpumask_t *mask;
303 char buf[64];
304
305 if (node_to_cpumask_map == NULL) {
306 printk(KERN_ERR "node_to_cpumask_map NULL\n");
307 dump_stack();
308 return;
309 }
310
311 mask = &node_to_cpumask_map[node];
312 if (enable)
313 cpu_set(cpu, *mask);
314 else
315 cpu_clear(cpu, *mask);
316
Rusty Russell29c01772008-12-13 21:20:25 +1030317 cpulist_scnprintf(buf, sizeof(buf), mask);
Mike Travis9f248bd2008-05-12 21:21:12 +0200318 printk(KERN_DEBUG "%s cpu %d node %d: mask now %s\n",
Jaswinder Singh Rajput8a87dd92009-01-04 17:04:26 +0530319 enable ? "numa_add_cpu" : "numa_remove_cpu", cpu, node, buf);
320}
Mike Travis9f248bd2008-05-12 21:21:12 +0200321
322void __cpuinit numa_add_cpu(int cpu)
323{
324 numa_set_cpumask(cpu, 1);
325}
326
327void __cpuinit numa_remove_cpu(int cpu)
328{
329 numa_set_cpumask(cpu, 0);
330}
Mike Travis23ca4bb2008-05-12 21:21:12 +0200331
332int cpu_to_node(int cpu)
333{
334 if (early_per_cpu_ptr(x86_cpu_to_node_map)) {
335 printk(KERN_WARNING
336 "cpu_to_node(%d): usage too early!\n", cpu);
337 dump_stack();
338 return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu];
339 }
340 return per_cpu(x86_cpu_to_node_map, cpu);
341}
342EXPORT_SYMBOL(cpu_to_node);
343
Mike Travis9f248bd2008-05-12 21:21:12 +0200344/*
345 * Same function as cpu_to_node() but used if called before the
346 * per_cpu areas are setup.
347 */
Mike Travis23ca4bb2008-05-12 21:21:12 +0200348int early_cpu_to_node(int cpu)
349{
350 if (early_per_cpu_ptr(x86_cpu_to_node_map))
351 return early_per_cpu_ptr(x86_cpu_to_node_map)[cpu];
352
353 if (!per_cpu_offset(cpu)) {
354 printk(KERN_WARNING
355 "early_cpu_to_node(%d): no per_cpu area!\n", cpu);
Mike Travis9f248bd2008-05-12 21:21:12 +0200356 dump_stack();
Mike Travis23ca4bb2008-05-12 21:21:12 +0200357 return NUMA_NO_NODE;
358 }
359 return per_cpu(x86_cpu_to_node_map, cpu);
360}
Mike Travis9f248bd2008-05-12 21:21:12 +0200361
Mike Travis6a2f47c2008-06-27 10:10:13 -0700362
363/* empty cpumask */
364static const cpumask_t cpu_mask_none;
365
Mike Travis9f248bd2008-05-12 21:21:12 +0200366/*
367 * Returns a pointer to the bitmask of CPUs on Node 'node'.
368 */
Rusty Russell393d68f2008-12-26 22:23:38 +1030369const cpumask_t *cpumask_of_node(int node)
Mike Travis9f248bd2008-05-12 21:21:12 +0200370{
371 if (node_to_cpumask_map == NULL) {
372 printk(KERN_WARNING
Rusty Russell393d68f2008-12-26 22:23:38 +1030373 "cpumask_of_node(%d): no node_to_cpumask_map!\n",
Mike Travis9f248bd2008-05-12 21:21:12 +0200374 node);
375 dump_stack();
Mike Travis11369f352008-07-08 14:35:21 -0700376 return (const cpumask_t *)&cpu_online_map;
Mike Travis9f248bd2008-05-12 21:21:12 +0200377 }
Mike Travis6a2f47c2008-06-27 10:10:13 -0700378 if (node >= nr_node_ids) {
379 printk(KERN_WARNING
Rusty Russell393d68f2008-12-26 22:23:38 +1030380 "cpumask_of_node(%d): node > nr_node_ids(%d)\n",
Mike Travis6a2f47c2008-06-27 10:10:13 -0700381 node, nr_node_ids);
382 dump_stack();
Mike Travis11369f352008-07-08 14:35:21 -0700383 return &cpu_mask_none;
Mike Travis6a2f47c2008-06-27 10:10:13 -0700384 }
Mike Travis11369f352008-07-08 14:35:21 -0700385 return &node_to_cpumask_map[node];
Mike Travis9f248bd2008-05-12 21:21:12 +0200386}
Rusty Russell393d68f2008-12-26 22:23:38 +1030387EXPORT_SYMBOL(cpumask_of_node);
Mike Travis9f248bd2008-05-12 21:21:12 +0200388
389/*
390 * Returns a bitmask of CPUs on Node 'node'.
Mike Travis6a2f47c2008-06-27 10:10:13 -0700391 *
392 * Side note: this function creates the returned cpumask on the stack
393 * so with a high NR_CPUS count, excessive stack space is used. The
394 * node_to_cpumask_ptr function should be used whenever possible.
Mike Travis9f248bd2008-05-12 21:21:12 +0200395 */
396cpumask_t node_to_cpumask(int node)
397{
398 if (node_to_cpumask_map == NULL) {
399 printk(KERN_WARNING
400 "node_to_cpumask(%d): no node_to_cpumask_map!\n", node);
401 dump_stack();
402 return cpu_online_map;
403 }
Mike Travis6a2f47c2008-06-27 10:10:13 -0700404 if (node >= nr_node_ids) {
405 printk(KERN_WARNING
406 "node_to_cpumask(%d): node > nr_node_ids(%d)\n",
407 node, nr_node_ids);
408 dump_stack();
409 return cpu_mask_none;
410 }
Mike Travis9f248bd2008-05-12 21:21:12 +0200411 return node_to_cpumask_map[node];
412}
413EXPORT_SYMBOL(node_to_cpumask);
414
415/*
416 * --------- end of debug versions of the numa functions ---------
417 */
418
419#endif /* CONFIG_DEBUG_PER_CPU_MAPS */
420
421#endif /* X86_64_NUMA */
Bernhard Walle1ecd2762008-06-20 15:38:22 +0200422