WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] numa: Correct handling node with CPU popu

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] numa: Correct handling node with CPU populated but no memory populated
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 28 Dec 2009 01:45:12 -0800
Delivery-date: Mon, 28 Dec 2009 01:45:22 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1261993011 0
# Node ID ddb8c5e798f961c0aa7685aa306451bdc6b709b3
# Parent  cba7ef4d08a3a3a31fe29b706878a7475c3d03b2
numa: Correct handling node with CPU populated but no memory populated

In changeset 20599, the node that has no memory populated is marked
parsed, but not online. However, if there are CPU populated in this
node, the corresponding CPU mapping (i.e. the cpu_to_node) is still
setup to the offline node, this will cause trouble for memory
allocation.

This patch changes the init_cpu_to_node() and srant_detect_node(), to
considering the node is offlined situation.

Now the apicid_to_node is only used to keep the mapping between
cpu/node provided by BIOS, and should not be used for memory
allocation anymore.

One thing left is to update the cpu_to_node mapping after memory
populated by memory hot-add.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@xxxxxxxxx>
---
 xen/arch/x86/numa.c      |   12 ++++++++----
 xen/arch/x86/setup.c     |    3 ++-
 xen/arch/x86/smpboot.c   |    2 +-
 xen/arch/x86/x86_64/mm.c |    2 +-
 4 files changed, 12 insertions(+), 7 deletions(-)

diff -r cba7ef4d08a3 -r ddb8c5e798f9 xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c       Mon Dec 28 09:32:39 2009 +0000
+++ b/xen/arch/x86/numa.c       Mon Dec 28 09:36:51 2009 +0000
@@ -35,6 +35,9 @@ unsigned char cpu_to_node[NR_CPUS] __rea
 unsigned char cpu_to_node[NR_CPUS] __read_mostly = {
        [0 ... NR_CPUS-1] = NUMA_NO_NODE
 };
+/*
+ * Keep BIOS's CPU2node information, should not be used for memory allocaion
+ */
 unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
        [0 ... MAX_LOCAL_APIC-1] = NUMA_NO_NODE
 };
@@ -288,14 +291,15 @@ static __init int numa_setup(char *opt)
  */
 void __devinit init_cpu_to_node(void)
 {
-       int i;
+       int i, node;
        for (i = 0; i < NR_CPUS; i++) {
                u32 apicid = x86_cpu_to_apicid[i];
                if (apicid == BAD_APICID)
                        continue;
-               if (apicid_to_node[apicid] == NUMA_NO_NODE)
-                       continue;
-               numa_set_node(i,apicid_to_node[apicid]);
+               node = apicid_to_node[apicid];
+               if ( node == NUMA_NO_NODE || !node_online(node) )
+                       node = 0;
+               numa_set_node(i, node);
        }
 }
 
diff -r cba7ef4d08a3 -r ddb8c5e798f9 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Mon Dec 28 09:32:39 2009 +0000
+++ b/xen/arch/x86/setup.c      Mon Dec 28 09:36:51 2009 +0000
@@ -20,6 +20,7 @@
 #include <xen/rcupdate.h>
 #include <xen/vga.h>
 #include <xen/dmi.h>
+#include <xen/nodemask.h>
 #include <public/version.h>
 #ifdef CONFIG_COMPAT
 #include <compat/platform.h>
@@ -252,7 +253,7 @@ void __devinit srat_detect_node(int cpu)
     u32 apicid = x86_cpu_to_apicid[cpu];
 
     node = apicid_to_node[apicid];
-    if ( node == NUMA_NO_NODE )
+    if ( node == NUMA_NO_NODE || !node_online(node) )
         node = 0;
     numa_set_node(cpu, node);
 
diff -r cba7ef4d08a3 -r ddb8c5e798f9 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Mon Dec 28 09:32:39 2009 +0000
+++ b/xen/arch/x86/smpboot.c    Mon Dec 28 09:36:51 2009 +0000
@@ -913,7 +913,7 @@ static int __devinit do_boot_cpu(int api
        }
 #else
        if (!per_cpu(compat_arg_xlat, cpu))
-               setup_compat_arg_xlat(cpu, apicid_to_node[apicid]);
+               setup_compat_arg_xlat(cpu, cpu_to_node[cpu]);
 #endif
 
        if (!idt_tables[cpu]) {
diff -r cba7ef4d08a3 -r ddb8c5e798f9 xen/arch/x86/x86_64/mm.c
--- a/xen/arch/x86/x86_64/mm.c  Mon Dec 28 09:32:39 2009 +0000
+++ b/xen/arch/x86/x86_64/mm.c  Mon Dec 28 09:36:51 2009 +0000
@@ -997,7 +997,7 @@ void __init subarch_init_memory(void)
     }
 
     if ( setup_compat_arg_xlat(smp_processor_id(),
-                               apicid_to_node[boot_cpu_physical_apicid]) )
+                               cpu_to_node[0]) )
         panic("Could not setup argument translation area");
 }
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] numa: Correct handling node with CPU populated but no memory populated, Xen patchbot-unstable <=