aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Travis <travis@sgi.com>2008-03-25 18:06:51 -0400
committerIngo Molnar <mingo@elte.hu>2008-04-17 11:41:34 -0400
commitb447a468fcd130aa8951672b6115c673c274e888 (patch)
tree3824624df1191cb1e6abbf9f9dbeca3f9d8c17f8
parenta24eae88ad3767d0a4a940a10e4a9cec849b7778 (diff)
x86: clean up non-smp usage of cpu maps
Cleanup references to the early cpu maps for the non-SMP configuration and remove some functions called for SMP configurations only. Cc: Andi Kleen <ak@suse.de> Cc: Christoph Lameter <clameter@sgi.com> Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r--arch/x86/kernel/setup.c28
-rw-r--r--arch/x86/mm/numa_64.c4
-rw-r--r--include/asm-x86/smp.h5
-rw-r--r--include/asm-x86/topology.h15
4 files changed, 30 insertions, 22 deletions
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 1179aa06cdbf..dc7940955b7a 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -10,7 +10,7 @@
10#include <asm/setup.h> 10#include <asm/setup.h>
11#include <asm/topology.h> 11#include <asm/topology.h>
12 12
13#ifdef CONFIG_HAVE_SETUP_PER_CPU_AREA 13#if defined(CONFIG_HAVE_SETUP_PER_CPU_AREA) && defined(CONFIG_SMP)
14/* 14/*
15 * Copy data used in early init routines from the initial arrays to the 15 * Copy data used in early init routines from the initial arrays to the
16 * per cpu data areas. These arrays then become expendable and the 16 * per cpu data areas. These arrays then become expendable and the
@@ -21,22 +21,13 @@ static void __init setup_per_cpu_maps(void)
21 int cpu; 21 int cpu;
22 22
23 for_each_possible_cpu(cpu) { 23 for_each_possible_cpu(cpu) {
24#ifdef CONFIG_SMP 24 per_cpu(x86_cpu_to_apicid, cpu) = x86_cpu_to_apicid_init[cpu];
25 if (per_cpu_offset(cpu)) { 25 per_cpu(x86_bios_cpu_apicid, cpu) =
26#endif
27 per_cpu(x86_cpu_to_apicid, cpu) =
28 x86_cpu_to_apicid_init[cpu];
29 per_cpu(x86_bios_cpu_apicid, cpu) =
30 x86_bios_cpu_apicid_init[cpu]; 26 x86_bios_cpu_apicid_init[cpu];
31#ifdef CONFIG_NUMA 27#ifdef CONFIG_NUMA
32 per_cpu(x86_cpu_to_node_map, cpu) = 28 per_cpu(x86_cpu_to_node_map, cpu) =
33 x86_cpu_to_node_map_init[cpu]; 29 x86_cpu_to_node_map_init[cpu];
34#endif 30#endif
35#ifdef CONFIG_SMP
36 } else
37 printk(KERN_NOTICE "per_cpu_offset zero for cpu %d\n",
38 cpu);
39#endif
40 } 31 }
41 32
42 /* indicate the early static arrays will soon be gone */ 33 /* indicate the early static arrays will soon be gone */
@@ -72,17 +63,20 @@ void __init setup_per_cpu_areas(void)
72 63
73 /* Copy section for each CPU (we discard the original) */ 64 /* Copy section for each CPU (we discard the original) */
74 size = PERCPU_ENOUGH_ROOM; 65 size = PERCPU_ENOUGH_ROOM;
75
76 printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n", 66 printk(KERN_INFO "PERCPU: Allocating %lu bytes of per cpu data\n",
77 size); 67 size);
78 for_each_cpu_mask(i, cpu_possible_map) { 68
69 for_each_possible_cpu(i) {
79 char *ptr; 70 char *ptr;
80#ifndef CONFIG_NEED_MULTIPLE_NODES 71#ifndef CONFIG_NEED_MULTIPLE_NODES
81 ptr = alloc_bootmem_pages(size); 72 ptr = alloc_bootmem_pages(size);
82#else 73#else
83 int node = early_cpu_to_node(i); 74 int node = early_cpu_to_node(i);
84 if (!node_online(node) || !NODE_DATA(node)) 75 if (!node_online(node) || !NODE_DATA(node)) {
85 ptr = alloc_bootmem_pages(size); 76 ptr = alloc_bootmem_pages(size);
77 printk(KERN_INFO
78 "cpu %d has no node or node-local memory\n", i);
79 }
86 else 80 else
87 ptr = alloc_bootmem_pages_node(NODE_DATA(node), size); 81 ptr = alloc_bootmem_pages_node(NODE_DATA(node), size);
88#endif 82#endif
@@ -96,7 +90,7 @@ void __init setup_per_cpu_areas(void)
96 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start); 90 memcpy(ptr, __per_cpu_start, __per_cpu_end - __per_cpu_start);
97 } 91 }
98 92
99 /* setup percpu data maps early */ 93 /* Setup percpu data maps */
100 setup_per_cpu_maps(); 94 setup_per_cpu_maps();
101} 95}
102 96
diff --git a/arch/x86/mm/numa_64.c b/arch/x86/mm/numa_64.c
index 18267a02e67a..2ea56f48f29b 100644
--- a/arch/x86/mm/numa_64.c
+++ b/arch/x86/mm/numa_64.c
@@ -31,13 +31,15 @@ bootmem_data_t plat_node_bdata[MAX_NUMNODES];
31 31
32struct memnode memnode; 32struct memnode memnode;
33 33
34#ifdef CONFIG_SMP
34int x86_cpu_to_node_map_init[NR_CPUS] = { 35int x86_cpu_to_node_map_init[NR_CPUS] = {
35 [0 ... NR_CPUS-1] = NUMA_NO_NODE 36 [0 ... NR_CPUS-1] = NUMA_NO_NODE
36}; 37};
37void *x86_cpu_to_node_map_early_ptr; 38void *x86_cpu_to_node_map_early_ptr;
39EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr);
40#endif
38DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE; 41DEFINE_PER_CPU(int, x86_cpu_to_node_map) = NUMA_NO_NODE;
39EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map); 42EXPORT_PER_CPU_SYMBOL(x86_cpu_to_node_map);
40EXPORT_SYMBOL(x86_cpu_to_node_map_early_ptr);
41 43
42s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = { 44s16 apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
43 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE 45 [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
diff --git a/include/asm-x86/smp.h b/include/asm-x86/smp.h
index 654724c58f5b..d973c11688ce 100644
--- a/include/asm-x86/smp.h
+++ b/include/asm-x86/smp.h
@@ -29,10 +29,15 @@ extern int smp_num_siblings;
29extern unsigned int num_processors; 29extern unsigned int num_processors;
30extern cpumask_t cpu_initialized; 30extern cpumask_t cpu_initialized;
31 31
32#ifdef CONFIG_SMP
32extern u16 x86_cpu_to_apicid_init[]; 33extern u16 x86_cpu_to_apicid_init[];
33extern u16 x86_bios_cpu_apicid_init[]; 34extern u16 x86_bios_cpu_apicid_init[];
34extern void *x86_cpu_to_apicid_early_ptr; 35extern void *x86_cpu_to_apicid_early_ptr;
35extern void *x86_bios_cpu_apicid_early_ptr; 36extern void *x86_bios_cpu_apicid_early_ptr;
37#else
38#define x86_cpu_to_apicid_early_ptr NULL
39#define x86_bios_cpu_apicid_early_ptr NULL
40#endif
36 41
37DECLARE_PER_CPU(cpumask_t, cpu_sibling_map); 42DECLARE_PER_CPU(cpumask_t, cpu_sibling_map);
38DECLARE_PER_CPU(cpumask_t, cpu_core_map); 43DECLARE_PER_CPU(cpumask_t, cpu_core_map);
diff --git a/include/asm-x86/topology.h b/include/asm-x86/topology.h
index 8d1a1f3d21b4..81a29eb08ac4 100644
--- a/include/asm-x86/topology.h
+++ b/include/asm-x86/topology.h
@@ -38,8 +38,13 @@ extern int cpu_to_node_map[];
38#endif 38#endif
39 39
40DECLARE_PER_CPU(int, x86_cpu_to_node_map); 40DECLARE_PER_CPU(int, x86_cpu_to_node_map);
41
42#ifdef CONFIG_SMP
41extern int x86_cpu_to_node_map_init[]; 43extern int x86_cpu_to_node_map_init[];
42extern void *x86_cpu_to_node_map_early_ptr; 44extern void *x86_cpu_to_node_map_early_ptr;
45#else
46#define x86_cpu_to_node_map_early_ptr NULL
47#endif
43 48
44extern cpumask_t node_to_cpumask_map[]; 49extern cpumask_t node_to_cpumask_map[];
45 50
@@ -54,6 +59,8 @@ static inline int cpu_to_node(int cpu)
54} 59}
55 60
56#else /* CONFIG_X86_64 */ 61#else /* CONFIG_X86_64 */
62
63#ifdef CONFIG_SMP
57static inline int early_cpu_to_node(int cpu) 64static inline int early_cpu_to_node(int cpu)
58{ 65{
59 int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr; 66 int *cpu_to_node_map = x86_cpu_to_node_map_early_ptr;
@@ -65,6 +72,9 @@ static inline int early_cpu_to_node(int cpu)
65 else 72 else
66 return NUMA_NO_NODE; 73 return NUMA_NO_NODE;
67} 74}
75#else
76#define early_cpu_to_node(cpu) cpu_to_node(cpu)
77#endif
68 78
69static inline int cpu_to_node(int cpu) 79static inline int cpu_to_node(int cpu)
70{ 80{
@@ -76,10 +86,7 @@ static inline int cpu_to_node(int cpu)
76 return ((int *)x86_cpu_to_node_map_early_ptr)[cpu]; 86 return ((int *)x86_cpu_to_node_map_early_ptr)[cpu];
77 } 87 }
78#endif 88#endif
79 if (per_cpu_offset(cpu)) 89 return per_cpu(x86_cpu_to_node_map, cpu);
80 return per_cpu(x86_cpu_to_node_map, cpu);
81 else
82 return NUMA_NO_NODE;
83} 90}
84#endif /* CONFIG_X86_64 */ 91#endif /* CONFIG_X86_64 */
85 92