[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] [XEN] Clean up NUMA stuff and disable by default ('numa=on' enables it).



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Node ID 3db344ea80705478cef942254e5772c5739fafc9
# Parent  6788aedb820c7be481e23662a24a7c77fc2b7a9c
[XEN] Clean up NUMA stuff and disable by default ('numa=on' enables it).
Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>
---
 xen/include/asm-x86/numnodes.h |   26 ----------------------
 xen/include/asm-x86/topology.h |   40 ----------------------------------
 xen/include/xen/topology.h     |   27 -----------------------
 xen/arch/x86/numa.c            |   48 +++++++++++++++++++++++------------------
 xen/arch/x86/setup.c           |   28 ++++++++++-------------
 xen/arch/x86/smpboot.c         |    1 
 xen/arch/x86/srat.c            |   12 ----------
 xen/common/page_alloc.c        |    8 ++----
 xen/include/asm-x86/acpi.h     |    1 
 xen/include/asm-x86/numa.h     |   21 ++++++++++++++---
 xen/include/xen/nodemask.h     |    4 ---
 xen/include/xen/numa.h         |   24 --------------------
 12 files changed, 62 insertions(+), 178 deletions(-)

diff -r 6788aedb820c -r 3db344ea8070 xen/arch/x86/numa.c
--- a/xen/arch/x86/numa.c       Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/arch/x86/numa.c       Wed Oct 25 15:17:40 2006 +0100
@@ -12,9 +12,11 @@
 #include <xen/numa.h>
 #include <xen/keyhandler.h>
 #include <xen/time.h>
-
-#include <asm/numa.h>
+#include <xen/smp.h>
 #include <asm/acpi.h>
+
+static int numa_setup(char *s);
+custom_param("numa", numa_setup);
 
 #ifndef Dprintk
 #define Dprintk(x...)
@@ -28,7 +30,7 @@ int memnode_shift;
 int memnode_shift;
 u8  memnodemap[NODEMAPSIZE];
 
-unsigned int cpu_to_node[NR_CPUS] __read_mostly = {
+unsigned char cpu_to_node[NR_CPUS] __read_mostly = {
        [0 ... NR_CPUS-1] = NUMA_NO_NODE
 };
 unsigned char apicid_to_node[MAX_LOCAL_APIC] __cpuinitdata = {
@@ -38,7 +40,8 @@ cpumask_t node_to_cpumask[MAX_NUMNODES] 
 
 nodemask_t node_online_map = { { [0] = 1UL } };
 
-int numa_off __initdata;
+/* Default NUMA to off for now. acpi=on required to enable it. */
+int numa_off __initdata = 1;
 
 int acpi_numa __initdata;
 
@@ -70,7 +73,7 @@ populate_memnodemap(const struct node *n
                        if (memnodemap[addr >> shift] != 0xff)
                                return -1;
                        memnodemap[addr >> shift] = i;
-                       addr += (1UL << shift);
+                       addr += (1UL << shift);
                } while (addr < end);
                res = 1;
        } 
@@ -133,8 +136,7 @@ void __init numa_init_array(void)
 }
 
 #ifdef CONFIG_NUMA_EMU
-/* default to faking a single node as fallback for non-NUMA hardware */
-int numa_fake __initdata = 1;
+static int numa_fake __initdata = 0;
 
 /* Numa emulation */
 static int numa_emulation(unsigned long start_pfn, unsigned long end_pfn)
@@ -160,9 +162,9 @@ static int numa_emulation(unsigned long 
                        sz = (end_pfn<<PAGE_SHIFT) - nodes[i].start;
                nodes[i].end = nodes[i].start + sz;
                printk(KERN_INFO "Faking node %d at %"PRIx64"-%"PRIx64" 
(%"PRIu64"MB)\n",
-                      i,
-                      nodes[i].start, nodes[i].end,
-                      (nodes[i].end - nodes[i].start) >> 20);
+                      i,
+                      nodes[i].start, nodes[i].end,
+                      (nodes[i].end - nodes[i].start) >> 20);
                node_set_online(i);
        }
        memnode_shift = compute_hash_shift(nodes, numa_fake);
@@ -182,16 +184,15 @@ void __init numa_initmem_init(unsigned l
 { 
        int i;
 
+#ifdef CONFIG_NUMA_EMU
+       if (numa_fake && !numa_emulation(start_pfn, end_pfn))
+               return;
+#endif
+
 #ifdef CONFIG_ACPI_NUMA
        if (!numa_off && !acpi_scan_nodes(start_pfn << PAGE_SHIFT,
                                          end_pfn << PAGE_SHIFT))
-               return;
-#endif
-
-#ifdef CONFIG_NUMA_EMU
-   /* fake a numa node for non-numa hardware */
-       if (numa_fake && !numa_emulation(start_pfn, end_pfn))
-               return;
+               return;
 #endif
 
        printk(KERN_INFO "%s\n",
@@ -200,7 +201,7 @@ void __init numa_initmem_init(unsigned l
        printk(KERN_INFO "Faking a node at %016lx-%016lx\n", 
               start_pfn << PAGE_SHIFT,
               end_pfn << PAGE_SHIFT); 
-               /* setup dummy node covering all memory */ 
+       /* setup dummy node covering all memory */ 
        memnode_shift = 63; 
        memnodemap[0] = 0;
        nodes_clear(node_online_map);
@@ -222,20 +223,25 @@ void __cpuinit numa_set_node(int cpu, in
 }
 
 /* [numa=off] */
-__init int numa_setup(char *opt) 
+static __init int numa_setup(char *opt) 
 { 
        if (!strncmp(opt,"off",3))
                numa_off = 1;
+       if (!strncmp(opt,"on",2))
+               numa_off = 0;
 #ifdef CONFIG_NUMA_EMU
        if(!strncmp(opt, "fake=", 5)) {
+               numa_off = 0;
                numa_fake = simple_strtoul(opt+5,NULL,0); ;
                if (numa_fake >= MAX_NUMNODES)
                        numa_fake = MAX_NUMNODES;
        }
 #endif
 #ifdef CONFIG_ACPI_NUMA
-       if (!strncmp(opt,"noacpi",6))
-               acpi_numa = -1;
+       if (!strncmp(opt,"noacpi",6)) {
+               numa_off = 0;
+               acpi_numa = -1;
+       }
 #endif
        return 1;
 } 
diff -r 6788aedb820c -r 3db344ea8070 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c      Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/arch/x86/setup.c      Wed Oct 25 15:17:40 2006 +0100
@@ -26,7 +26,6 @@
 #include <asm/desc.h>
 #include <asm/shadow.h>
 #include <asm/e820.h>
-#include <asm/numa.h>
 #include <acm/acm_hooks.h>
 
 extern void dmi_scan_machine(void);
@@ -62,9 +61,6 @@ boolean_param("watchdog", opt_watchdog);
 /* "acpi=noirq":  Disables ACPI interrupt routing.                  */
 static void parse_acpi_param(char *s);
 custom_param("acpi", parse_acpi_param);
-
-extern int numa_setup(char *s);
-custom_param("numa", numa_setup);
 
 /* **** Linux config option: propagated to domain0. */
 /* acpi_skip_timer_override: Skip IRQ0 overrides. */
@@ -265,16 +261,16 @@ static void __init init_idle_domain(void
 
 static void srat_detect_node(int cpu)
 {
-   unsigned node;
-   u8 apicid = x86_cpu_to_apicid[cpu];
-
-   node = apicid_to_node[apicid];
-   if (node == NUMA_NO_NODE)
-      node = 0;
-   numa_set_node(cpu, node);
-
-   if (acpi_numa > 0)
-      printk(KERN_INFO "CPU %d APIC %d -> Node %d\n", cpu, apicid, node);
+    unsigned node;
+    u8 apicid = x86_cpu_to_apicid[cpu];
+
+    node = apicid_to_node[apicid];
+    if ( node == NUMA_NO_NODE )
+        node = 0;
+    numa_set_node(cpu, node);
+
+    if ( acpi_numa > 0 )
+        printk(KERN_INFO "CPU %d APIC %d -> Node %d\n", cpu, apicid, node);
 }
 
 void __init __start_xen(multiboot_info_t *mbi)
@@ -617,9 +613,9 @@ void __init __start_xen(multiboot_info_t
         if ( !cpu_online(i) )
             __cpu_up(i);
 
-               /* setup cpu_to_node[] */
+        /* Set up cpu_to_node[]. */
         srat_detect_node(i);
-               /* setup node_to_cpumask based on cpu_to_node[] */
+        /* Set up node_to_cpumask based on cpu_to_node[]. */
         numa_add_cpu(i);        
     }
 
diff -r 6788aedb820c -r 3db344ea8070 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/arch/x86/smpboot.c    Wed Oct 25 15:17:40 2006 +0100
@@ -44,7 +44,6 @@
 #include <xen/softirq.h>
 #include <xen/serial.h>
 #include <xen/numa.h>
-#include <asm/numa.h>
 #include <asm/current.h>
 #include <asm/mc146818rtc.h>
 #include <asm/desc.h>
diff -r 6788aedb820c -r 3db344ea8070 xen/arch/x86/srat.c
--- a/xen/arch/x86/srat.c       Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/arch/x86/srat.c       Wed Oct 25 15:17:40 2006 +0100
@@ -11,22 +11,12 @@
  * Adapted for Xen: Ryan Harper <ryanh@xxxxxxxxxx>
  */
 
-#if 0
-#include <linux/kernel.h>
-#include <linux/module.h>
-#include <asm/proto.h>
-#include <xen/bitmap.h>
-#include <xen/numa.h>
-#include <xen/topology.h>
-#include <asm/e820.h>
-#endif
 #include <xen/init.h>
 #include <xen/mm.h>
 #include <xen/inttypes.h>
 #include <xen/nodemask.h>
 #include <xen/acpi.h>
-
-#include <asm/numa.h>
+#include <xen/numa.h>
 #include <asm/page.h>
 
 static struct acpi_table_slit *acpi_slit;
diff -r 6788aedb820c -r 3db344ea8070 xen/common/page_alloc.c
--- a/xen/common/page_alloc.c   Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/common/page_alloc.c   Wed Oct 25 15:17:40 2006 +0100
@@ -34,9 +34,9 @@
 #include <xen/domain_page.h>
 #include <xen/keyhandler.h>
 #include <xen/perfc.h>
+#include <xen/numa.h>
+#include <xen/nodemask.h>
 #include <asm/page.h>
-#include <asm/numa.h>
-#include <asm/topology.h>
 
 /*
  * Comma-separated list of hexadecimal page numbers containing bad bytes.
@@ -702,9 +702,7 @@ inline struct page_info *alloc_domheap_p
     struct domain *d, unsigned int order, unsigned int flags)
 {
     return __alloc_domheap_pages(d, smp_processor_id(), order, flags);
-
-}
-
+}
 
 void free_domheap_pages(struct page_info *pg, unsigned int order)
 {
diff -r 6788aedb820c -r 3db344ea8070 xen/include/asm-x86/acpi.h
--- a/xen/include/asm-x86/acpi.h        Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/include/asm-x86/acpi.h        Wed Oct 25 15:17:40 2006 +0100
@@ -159,6 +159,7 @@ static inline int acpi_irq_balance_set(c
 static inline int acpi_irq_balance_set(char *str) { return 0; }
 extern int acpi_scan_nodes(u64 start, u64 end);
 extern int acpi_numa;
+#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
 
 #ifdef CONFIG_ACPI_SLEEP
 
diff -r 6788aedb820c -r 3db344ea8070 xen/include/asm-x86/numa.h
--- a/xen/include/asm-x86/numa.h        Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/include/asm-x86/numa.h        Wed Oct 25 15:17:40 2006 +0100
@@ -1,10 +1,17 @@
 #ifndef _ASM_X8664_NUMA_H 
 #define _ASM_X8664_NUMA_H 1
 
-#include <xen/nodemask.h>
-#include <xen/topology.h>
-#include <asm/numnodes.h>
-#include <asm/smp.h>
+#include <xen/cpumask.h>
+
+#define NODES_SHIFT 6
+
+extern unsigned char cpu_to_node[];
+extern cpumask_t     node_to_cpumask[];
+
+#define cpu_to_node(cpu)               (cpu_to_node[cpu])
+#define parent_node(node)              (node)
+#define node_to_first_cpu(node)  (__ffs(node_to_cpumask[node]))
+#define node_to_cpumask(node)    (node_to_cpumask[node])
 
 struct node { 
        u64 start,end; 
@@ -37,6 +44,12 @@ extern int memnode_shift;
 extern int memnode_shift; 
 extern u8  memnodemap[NODEMAPSIZE]; 
 
+struct node_data {
+    unsigned long node_start_pfn;
+    unsigned long node_spanned_pages;
+    unsigned int  node_id;
+};
+
 extern struct node_data node_data[];
 
 static inline __attribute__((pure)) int phys_to_nid(unsigned long addr) 
diff -r 6788aedb820c -r 3db344ea8070 xen/include/xen/nodemask.h
--- a/xen/include/xen/nodemask.h        Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/include/xen/nodemask.h        Wed Oct 25 15:17:40 2006 +0100
@@ -72,10 +72,6 @@
  *    way we do the other calls.
  */
 
-#if 0
-#include <linux/threads.h>
-#include <asm/bug.h>
-#endif
 #include <xen/kernel.h>
 #include <xen/bitmap.h>
 #include <xen/numa.h>
diff -r 6788aedb820c -r 3db344ea8070 xen/include/xen/numa.h
--- a/xen/include/xen/numa.h    Wed Oct 25 15:01:51 2006 +0100
+++ b/xen/include/xen/numa.h    Wed Oct 25 15:17:40 2006 +0100
@@ -2,34 +2,12 @@
 #define _XEN_NUMA_H
 
 #include <xen/config.h>
-
-#ifdef CONFIG_DISCONTIGMEM
-#include <asm/numnodes.h>
-#endif
+#include <asm/numa.h>
 
 #ifndef NODES_SHIFT
 #define NODES_SHIFT     0
 #endif
 
 #define MAX_NUMNODES    (1 << NODES_SHIFT)
-#define NUMA_NO_NODE    0xff
-
-#define MAX_PXM_DOMAINS    256   /* 1 byte and no promises about values */
-#define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8)
-#define MAX_CHUNKS_PER_NODE   4
-#define MAXCHUNKS    (MAX_CHUNKS_PER_NODE * MAX_NUMNODES)
-
-/* needed for drivers/acpi/numa.c */
-#define NR_NODE_MEMBLKS (MAX_NUMNODES*2)
-
-extern unsigned int cpu_to_node[];
-#include <xen/cpumask.h>
-extern cpumask_t node_to_cpumask[];
-
-typedef struct node_data {
-    unsigned long node_start_pfn;
-    unsigned long node_spanned_pages;
-    unsigned int  node_id;
-} node_data_t;
 
 #endif /* _XEN_NUMA_H */
diff -r 6788aedb820c -r 3db344ea8070 xen/include/asm-x86/numnodes.h
--- a/xen/include/asm-x86/numnodes.h    Wed Oct 25 15:01:51 2006 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-#ifndef _ASM_MAX_NUMNODES_H
-#define _ASM_MAX_NUMNODES_H
-
-#include <xen/config.h>
-
-#if defined(__i386__)
-#ifdef CONFIG_X86_NUMAQ
-
-/* Max 16 Nodes */
-#define NODES_SHIFT    4
-
-#elif defined(CONFIG_ACPI_SRAT)
-
-/* Max 8 Nodes */
-#define NODES_SHIFT    3
-
-#endif /* CONFIG_X86_NUMAQ */
-
-
-#endif /* __i386__ */
-
-#if defined(CONFIG_NUMA) && defined(__x86_64__)
-#define NODES_SHIFT  6
-#endif /* __x86_64__ */
-
-#endif /* _ASM_MAX_NUMNODES_H */
diff -r 6788aedb820c -r 3db344ea8070 xen/include/asm-x86/topology.h
--- a/xen/include/asm-x86/topology.h    Wed Oct 25 15:01:51 2006 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2006, IBM Corp.
- *
- * All rights reserved.          
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * Ryan Harper <ryanh@xxxxxxxxxx>
- */
-
-#ifndef _ASM_X86_TOPOLOGY_H
-#define _ASM_X86_TOPOLOGY_H
-
-#include <xen/config.h>
-#include <xen/bitops.h>
-
-extern cpumask_t cpu_online_map;
-
-extern unsigned int cpu_to_node[];
-extern cpumask_t     node_to_cpumask[];
-
-#define cpu_to_node(cpu)               (cpu_to_node[cpu])
-#define parent_node(node)              (node)
-#define node_to_first_cpu(node)  (__ffs(node_to_cpumask[node]))
-#define node_to_cpumask(node)    (node_to_cpumask[node])
-
-#endif  /* _ASM_X86_TOPOLOGY_H */
diff -r 6788aedb820c -r 3db344ea8070 xen/include/xen/topology.h
--- a/xen/include/xen/topology.h        Wed Oct 25 15:01:51 2006 +0100
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*
- * Copyright (C) 2006, IBM Corp.
- *
- * All rights reserved.          
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
- * NON INFRINGEMENT.  See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#ifndef _XEN_TOPOLOGY_H
-#define _XEN_TOPOLOGY_H
-
-#include <asm/topology.h>
-
-#endif /* _XEN_TOPOLOGY_H */

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.