Skip to content

Commit

Permalink
x86-32, NUMA: Replace srat_32.c with srat.c
Browse files Browse the repository at this point in the history
SRAT support implementation in srat_32.c and srat.c are generally
similar; however, there are some differences.

First of all, 64bit implementation supports more types of SRAT
entries.  64bit supports x2apic, affinity, memory and SLIT.  32bit
only supports processor and memory.

Most other differences stem from different initialization protocols
employed by 64bit and 32bit NUMA init paths.

On 64bit,

* Mappings among PXM, node and apicid are directly done in each SRAT
  entry callback.

* Memory affinity information is passed to numa_add_memblk() which
  takes care of all interfacing with NUMA init.

* Doesn't directly initialize NUMA configurations.  All the
  information is recorded in numa_nodes_parsed and memblks.

On 32bit,

* Checks numa_off.

* Things go through one more level of indirection via private tables
  but eventually end up initializing the same mappings.

* node_start/end_pfn[] are initialized and
  memblock_x86_register_active_regions() is called for each memory
  chunk.

* node_set_online() is called for each online node.

* sort_node_map() is called.

There are also other minor differences in sanity checking and messages
but taking 64bit version should be good enough.

This patch drops the 32bit specific implementation and makes the 64bit
implementation common for both 32 and 64bit.

The init protocol differences are dealt with in two places - the
numa_add_memblk() shim added in the previous patch and new temporary
numa_32.c:get_memcfg_from_srat() which wraps invocation of
x86_acpi_numa_init().

The shim numa_add_memblk() handles the folowings.

* node_start/end_pfn[] initialization.

* node_set_online() for memory nodes.

* Invocation of memblock_x86_register_active_regions().

The shim get_memcfg_from_srat() handles the followings.

* numa_off check.

* node_set_online() for CPU nodes.

* sort_node_map() invocation.

* Clearing of numa_nodes_parsed and active_ranges on failure.

The shims are temporary and will be removed as the generic NUMA init
path in 32bit is replaced with 64bit one.

Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: "H. Peter Anvin" <hpa@zytor.com>
  • Loading branch information
Tejun Heo committed May 2, 2011
1 parent b0d3108 commit 5acd91a
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 326 deletions.
2 changes: 0 additions & 2 deletions arch/x86/include/asm/mmzone_32.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ extern struct pglist_data *node_data[];
#define NODE_DATA(nid) (node_data[nid])

#include <asm/numaq.h>
/* summit or generic arch */
#include <asm/srat.h>

extern void resume_map_numa_kva(pgd_t *pgd);

Expand Down
39 changes: 0 additions & 39 deletions arch/x86/include/asm/srat.h

This file was deleted.

5 changes: 1 addition & 4 deletions arch/x86/mm/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,7 @@ obj-$(CONFIG_MMIOTRACE_TEST) += testmmiotrace.o

obj-$(CONFIG_NUMA) += numa.o numa_$(BITS).o
obj-$(CONFIG_AMD_NUMA) += amdtopology_64.o
ifeq ($(CONFIG_ACPI_NUMA),y)
obj-$(CONFIG_X86_64) += srat.o
obj-$(CONFIG_X86_32) += srat_32.o
endif
obj-$(CONFIG_ACPI_NUMA) += srat.o
obj-$(CONFIG_NUMA_EMU) += numa_emulation.o

obj-$(CONFIG_HAVE_MEMBLOCK) += memblock.o
Expand Down
23 changes: 23 additions & 0 deletions arch/x86/mm/numa_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,29 @@ static __init void init_alloc_remap(int nid)
nid, node_pa, node_pa + size, remap_va, remap_va + size);
}

static int get_memcfg_from_srat(void)
{
#ifdef CONFIG_ACPI_NUMA
int nid;

if (numa_off)
return 0;

if (x86_acpi_numa_init() < 0) {
nodes_clear(numa_nodes_parsed);
remove_all_active_ranges();
return 0;
}

for_each_node_mask(nid, numa_nodes_parsed)
node_set_online(nid);
sort_node_map();
return 1;
#else
return 0;
#endif
}

static void get_memcfg_numa(void)
{
if (get_memcfg_numaq())
Expand Down
281 changes: 0 additions & 281 deletions arch/x86/mm/srat_32.c

This file was deleted.

0 comments on commit 5acd91a

Please sign in to comment.