Commit 65b039a8 authored by Dave Hansen's avatar Dave Hansen Committed by Linus Torvalds

[PATCH] x86: allow SRAT to parse empty nodes

This patch is to allow the booting of a numa srat base i386 system without
requiring memory to be in all of it's nodes.  It breaks the assumption that
all nodes have memory during bootup.
Signed-off-by: default avatarKeith Mannthey <kmannth@us.ibm.com>
Signed-off-by: default avatarDave Hansen <haveblue@us.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3c810c50
...@@ -30,9 +30,7 @@ ...@@ -30,9 +30,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <asm/numaq.h> #include <asm/numaq.h>
#include <asm/topology.h>
/* These are needed before the pgdat's are created */
extern long node_start_pfn[], node_end_pfn[], node_remap_size[];
#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <asm/srat.h> #include <asm/srat.h>
#include <asm/topology.h>
/* /*
* proximity macros and definitions * proximity macros and definitions
...@@ -58,8 +59,6 @@ static int num_memory_chunks; /* total number of memory chunks */ ...@@ -58,8 +59,6 @@ static int num_memory_chunks; /* total number of memory chunks */
static int zholes_size_init; static int zholes_size_init;
static unsigned long zholes_size[MAX_NUMNODES * MAX_NR_ZONES]; static unsigned long zholes_size[MAX_NUMNODES * MAX_NR_ZONES];
extern unsigned long node_start_pfn[], node_end_pfn[], node_remap_size[];
extern void * boot_ioremap(unsigned long, unsigned long); extern void * boot_ioremap(unsigned long, unsigned long);
/* Identify CPU proximity domains */ /* Identify CPU proximity domains */
...@@ -273,6 +272,17 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp) ...@@ -273,6 +272,17 @@ static int __init acpi20_parse_srat(struct acpi_table_srat *sratp)
int been_here_before = 0; int been_here_before = 0;
for (j = 0; j < num_memory_chunks; j++){ for (j = 0; j < num_memory_chunks; j++){
/*
* Only add present memroy to node_end/start_pfn
* There is no guarantee from the srat that the memory
* is present at boot time.
*/
if (node_memory_chunk[j].start_pfn >= max_pfn) {
printk (KERN_INFO "Ignoring chunk of memory reported in the SRAT (could be hot-add zone?)\n");
printk (KERN_INFO "chunk is reported from pfn %04x to %04x\n",
node_memory_chunk[j].start_pfn, node_memory_chunk[j].end_pfn);
continue;
}
if (node_memory_chunk[j].nid == nid) { if (node_memory_chunk[j].nid == nid) {
if (been_here_before == 0) { if (been_here_before == 0) {
node_start_pfn[nid] = node_memory_chunk[j].start_pfn; node_start_pfn[nid] = node_memory_chunk[j].start_pfn;
......
...@@ -154,7 +154,7 @@ static void __init find_max_pfn_node(int nid) ...@@ -154,7 +154,7 @@ static void __init find_max_pfn_node(int nid)
*/ */
static void __init allocate_pgdat(int nid) static void __init allocate_pgdat(int nid)
{ {
if (nid) if (nid && node_has_online_mem(nid))
NODE_DATA(nid) = (pg_data_t *)node_remap_start_vaddr[nid]; NODE_DATA(nid) = (pg_data_t *)node_remap_start_vaddr[nid];
else { else {
NODE_DATA(nid) = (pg_data_t *)(__va(min_low_pfn << PAGE_SHIFT)); NODE_DATA(nid) = (pg_data_t *)(__va(min_low_pfn << PAGE_SHIFT));
...@@ -188,6 +188,9 @@ static unsigned long calculate_numa_remap_pages(void) ...@@ -188,6 +188,9 @@ static unsigned long calculate_numa_remap_pages(void)
for_each_online_node(nid) { for_each_online_node(nid) {
if (nid == 0) if (nid == 0)
continue; continue;
if (!node_remap_size[nid])
continue;
/* /*
* The acpi/srat node info can show hot-add memroy zones * The acpi/srat node info can show hot-add memroy zones
* where memory could be added but not currently present. * where memory could be added but not currently present.
...@@ -307,24 +310,27 @@ void __init zone_sizes_init(void) ...@@ -307,24 +310,27 @@ void __init zone_sizes_init(void)
max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT; max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
if (start > low) { if (node_has_online_mem(nid)){
if (start > low) {
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
BUG_ON(start > high); BUG_ON(start > high);
zones_size[ZONE_HIGHMEM] = high - start; zones_size[ZONE_HIGHMEM] = high - start;
#endif #endif
} else { } else {
if (low < max_dma) if (low < max_dma)
zones_size[ZONE_DMA] = low; zones_size[ZONE_DMA] = low;
else { else {
BUG_ON(max_dma > low); BUG_ON(max_dma > low);
BUG_ON(low > high); BUG_ON(low > high);
zones_size[ZONE_DMA] = max_dma; zones_size[ZONE_DMA] = max_dma;
zones_size[ZONE_NORMAL] = low - max_dma; zones_size[ZONE_NORMAL] = low - max_dma;
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
zones_size[ZONE_HIGHMEM] = high - low; zones_size[ZONE_HIGHMEM] = high - low;
#endif #endif
}
} }
} }
zholes_size = get_zholes_size(nid); zholes_size = get_zholes_size(nid);
/* /*
* We let the lmem_map for node 0 be allocated from the * We let the lmem_map for node 0 be allocated from the
......
...@@ -88,6 +88,12 @@ static inline cpumask_t pcibus_to_cpumask(int bus) ...@@ -88,6 +88,12 @@ static inline cpumask_t pcibus_to_cpumask(int bus)
.nr_balance_failed = 0, \ .nr_balance_failed = 0, \
} }
extern unsigned long node_start_pfn[];
extern unsigned long node_end_pfn[];
extern unsigned long node_remap_size[];
#define node_has_online_mem(nid) (node_start_pfn[nid] != node_end_pfn[nid])
#else /* !CONFIG_NUMA */ #else /* !CONFIG_NUMA */
/* /*
* Other i386 platforms should define their own version of the * Other i386 platforms should define their own version of the
......
...@@ -31,9 +31,12 @@ ...@@ -31,9 +31,12 @@
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/mmzone.h> #include <linux/mmzone.h>
#include <linux/smp.h> #include <linux/smp.h>
#include <asm/topology.h> #include <asm/topology.h>
#ifndef node_has_online_mem
#define node_has_online_mem(nid) (1)
#endif
#ifndef nr_cpus_node #ifndef nr_cpus_node
#define nr_cpus_node(node) \ #define nr_cpus_node(node) \
({ \ ({ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment