|
Lines 15-20
Link Here
|
| 15 |
#include <linux/bitmap.h> |
15 |
#include <linux/bitmap.h> |
| 16 |
#include <linux/module.h> |
16 |
#include <linux/module.h> |
| 17 |
#include <linux/topology.h> |
17 |
#include <linux/topology.h> |
|
|
18 |
#include <linux/bootmem.h> |
| 19 |
#include <linux/mm.h> |
| 18 |
#include <asm/proto.h> |
20 |
#include <asm/proto.h> |
| 19 |
#include <asm/numa.h> |
21 |
#include <asm/numa.h> |
| 20 |
#include <asm/e820.h> |
22 |
#include <asm/e820.h> |
|
Lines 24-29
static struct acpi_table_slit *acpi_slit
Link Here
|
| 24 |
static nodemask_t nodes_parsed __initdata; |
26 |
static nodemask_t nodes_parsed __initdata; |
| 25 |
static nodemask_t nodes_found __initdata; |
27 |
static nodemask_t nodes_found __initdata; |
| 26 |
static struct node nodes[MAX_NUMNODES] __initdata; |
28 |
static struct node nodes[MAX_NUMNODES] __initdata; |
|
|
29 |
struct node nodes_add[MAX_NUMNODES] __initdata; |
| 30 |
static int found_add_area __initdata; |
| 31 |
int ignore_hotadd __initdata; |
| 27 |
static u8 pxm2node[256] = { [0 ... 255] = 0xff }; |
32 |
static u8 pxm2node[256] = { [0 ... 255] = 0xff }; |
| 28 |
|
33 |
|
| 29 |
/* Too small nodes confuse the VM badly. Usually they result |
34 |
/* Too small nodes confuse the VM badly. Usually they result |
|
Lines 90-95
static __init void bad_srat(void)
Link Here
|
| 90 |
acpi_numa = -1; |
95 |
acpi_numa = -1; |
| 91 |
for (i = 0; i < MAX_LOCAL_APIC; i++) |
96 |
for (i = 0; i < MAX_LOCAL_APIC; i++) |
| 92 |
apicid_to_node[i] = NUMA_NO_NODE; |
97 |
apicid_to_node[i] = NUMA_NO_NODE; |
|
|
98 |
for (i = 0; i < MAX_NUMNODES; i++) |
| 99 |
nodes_add[i].start = nodes[i].end = 0; |
| 93 |
} |
100 |
} |
| 94 |
|
101 |
|
| 95 |
static __init inline int srat_disabled(void) |
102 |
static __init inline int srat_disabled(void) |
|
Lines 181-190
acpi_numa_memory_affinity_init(struct ac
Link Here
|
| 181 |
bad_srat(); |
188 |
bad_srat(); |
| 182 |
return; |
189 |
return; |
| 183 |
} |
190 |
} |
| 184 |
/* It is fine to add this area to the nodes data it will be used later*/ |
|
|
| 185 |
if (ma->flags.hot_pluggable == 1) |
| 186 |
printk(KERN_INFO "SRAT: hot plug zone found %lx - %lx \n", |
| 187 |
start, end); |
| 188 |
i = conflicting_nodes(start, end); |
191 |
i = conflicting_nodes(start, end); |
| 189 |
if (i == node) { |
192 |
if (i == node) { |
| 190 |
printk(KERN_WARNING |
193 |
printk(KERN_WARNING |
|
Lines 208-213
acpi_numa_memory_affinity_init(struct ac
Link Here
|
| 208 |
if (nd->end < end) |
211 |
if (nd->end < end) |
| 209 |
nd->end = end; |
212 |
nd->end = end; |
| 210 |
} |
213 |
} |
|
|
214 |
|
| 215 |
/* |
| 216 |
* It is fine to add this area to the nodes data it will be used later |
| 217 |
* This code supports one contigious hot add area per node. |
| 218 |
* The signed cast is intentional to catch underflows. |
| 219 |
*/ |
| 220 |
if (ma->flags.hot_pluggable == 1 && !ignore_hotadd) { |
| 221 |
unsigned long s_pfn = start >> PAGE_SHIFT; |
| 222 |
unsigned long e_pfn = end >> PAGE_SHIFT; |
| 223 |
|
| 224 |
/* Sorry guys - if you want working memory hotplug write correct SRATs */ |
| 225 |
if ((signed long)(end - start) < NODE_MIN_SIZE || |
| 226 |
e820_hole_size(s_pfn, e_pfn) != e_pfn - s_pfn) { |
| 227 |
printk(KERN_ERR |
| 228 |
"SRAT: Hotplug area %lx-%lx too small or overlaps with real memory\n", |
| 229 |
start, end); |
| 230 |
bad_srat(); |
| 231 |
return; |
| 232 |
} |
| 233 |
|
| 234 |
found_add_area = 1; |
| 235 |
if (nodes_add[node].start == nodes_add[node].end) { |
| 236 |
nodes_add[node].start = start; |
| 237 |
nodes_add[node].end = end; |
| 238 |
} else { |
| 239 |
if (nodes_add[node].start == end) |
| 240 |
nodes_add[node].start = start; |
| 241 |
if (nodes_add[node].end == start) |
| 242 |
nodes_add[node].end = end; |
| 243 |
} |
| 244 |
if ((nodes_add[node].end >> PAGE_SHIFT) > end_pfn) |
| 245 |
end_pfn = nodes_add[node].end >> PAGE_SHIFT; |
| 246 |
printk(KERN_INFO "SRAT: hot plug zone found %Lx - %Lx\n", |
| 247 |
nodes_add[node].start, nodes_add[node].end); |
| 248 |
} |
| 249 |
|
| 211 |
printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm, |
250 |
printk(KERN_INFO "SRAT: Node %u PXM %u %Lx-%Lx\n", node, pxm, |
| 212 |
nd->start, nd->end); |
251 |
nd->start, nd->end); |
| 213 |
} |
252 |
} |
|
Lines 225-230
static int nodes_cover_memory(void)
Link Here
|
| 225 |
unsigned long e = nodes[i].end >> PAGE_SHIFT; |
264 |
unsigned long e = nodes[i].end >> PAGE_SHIFT; |
| 226 |
pxmram += e - s; |
265 |
pxmram += e - s; |
| 227 |
pxmram -= e820_hole_size(s, e); |
266 |
pxmram -= e820_hole_size(s, e); |
|
|
267 |
pxmram -= nodes_add[i].end - nodes_add[i].start; |
| 268 |
if ((long)pxmram < 0) |
| 269 |
pxmram = 0; |
| 228 |
} |
270 |
} |
| 229 |
|
271 |
|
| 230 |
e820ram = end_pfn - e820_hole_size(0, end_pfn); |
272 |
e820ram = end_pfn - e820_hole_size(0, end_pfn); |
|
Lines 258-264
int __init acpi_scan_nodes(unsigned long
Link Here
|
| 258 |
|
300 |
|
| 259 |
/* First clean up the node list */ |
301 |
/* First clean up the node list */ |
| 260 |
for (i = 0; i < MAX_NUMNODES; i++) { |
302 |
for (i = 0; i < MAX_NUMNODES; i++) { |
| 261 |
cutoff_node(i, start, end); |
303 |
if (!found_add_area) |
|
|
304 |
cutoff_node(i, start, end); |
| 262 |
if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) |
305 |
if ((nodes[i].end - nodes[i].start) < NODE_MIN_SIZE) |
| 263 |
unparse_node(i); |
306 |
unparse_node(i); |
| 264 |
} |
307 |
} |
|
Lines 303-308
static int node_to_pxm(int n)
Link Here
|
| 303 |
return 0; |
346 |
return 0; |
| 304 |
} |
347 |
} |
| 305 |
|
348 |
|
|
|
349 |
void __init srat_reserve_add_area(int nodeid) |
| 350 |
{ |
| 351 |
if (found_add_area && nodes_add[nodeid].end) { |
| 352 |
printk(KERN_INFO |
| 353 |
"SRAT: Reserving hot-add memory space for node %d at %Lx-%Lx\n", |
| 354 |
nodeid, nodes_add[nodeid].start, nodes_add[nodeid].end); |
| 355 |
printk(KERN_INFO |
| 356 |
"SRAT: This will cost you %Lu MB of pre-allocated memory.\n", |
| 357 |
(((nodes_add[nodeid].end - |
| 358 |
nodes_add[nodeid].start)/PAGE_SIZE)*sizeof(struct page)) >> 20); |
| 359 |
|
| 360 |
reserve_bootmem_node(NODE_DATA(nodeid), nodes_add[nodeid].start, |
| 361 |
nodes_add[nodeid].end - nodes_add[nodeid].start); |
| 362 |
} |
| 363 |
} |
| 364 |
|
| 306 |
int __node_distance(int a, int b) |
365 |
int __node_distance(int a, int b) |
| 307 |
{ |
366 |
{ |
| 308 |
int index; |
367 |
int index; |