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

[Xen-changelog] [xen stable-4.5] x86/NUMA: fix setup_node()



commit 8bdfe147851d7b73f41613966ba6fc8659d6a5b9
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Sep 10 15:34:26 2015 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Sep 10 15:34:26 2015 +0200

    x86/NUMA: fix setup_node()
    
    The function referenced an __initdata object (nodes_found). Since this
    being a node mask was more complicated than needed, the variable gets
    replaced by a simple counter. Check at once that the count of nodes
    doesn't go beyond MAX_NUMNODES.
    
    Also consolidate three printk()s related to the function's use into just
    one.
    
    Finally (quite the opposite of the above issue) __init-annotate
    nodes_cover_memory().
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    master commit: 8f945d36d9bddd5b589ba23c7322b30d623dd084
    master date: 2015-08-31 13:51:52 +0200
---
 xen/arch/x86/srat.c |   26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/xen/arch/x86/srat.c b/xen/arch/x86/srat.c
index 29fc724..8ebabe2 100644
--- a/xen/arch/x86/srat.c
+++ b/xen/arch/x86/srat.c
@@ -25,7 +25,6 @@ static struct acpi_table_slit *__read_mostly acpi_slit;
 
 static nodemask_t memory_nodes_parsed __initdata;
 static nodemask_t processor_nodes_parsed __initdata;
-static nodemask_t nodes_found __initdata;
 static struct node nodes[MAX_NUMNODES] __initdata;
 static u8 __read_mostly pxm2node[256] = { [0 ... 255] = NUMA_NO_NODE };
 
@@ -45,17 +44,25 @@ int pxm_to_node(int pxm)
        return (signed char)pxm2node[pxm];
 }
 
-__devinit int setup_node(int pxm)
+int setup_node(int pxm)
 {
        unsigned node = pxm2node[pxm];
-       if (node == 0xff) {
-               if (nodes_weight(nodes_found) >= MAX_NUMNODES)
+
+       if (node == NUMA_NO_NODE) {
+               static bool_t warned;
+               static unsigned nodes_found;
+
+               node = nodes_found++;
+               if (node >= MAX_NUMNODES) {
+                       printk(KERN_WARNING
+                              "SRAT: Too many proximity domains (%#x)\n",
+                              pxm);
+                       warned = 1;
                        return -1;
-               node = first_unset_node(nodes_found); 
-               node_set(node, nodes_found);
+               }
                pxm2node[pxm] = node;
        }
-       return pxm2node[pxm];
+       return node;
 }
 
 int valid_numa_range(u64 start, u64 end, int node)
@@ -176,7 +183,6 @@ acpi_numa_x2apic_affinity_init(struct 
acpi_srat_x2apic_cpu_affinity *pa)
        pxm = pa->proximity_domain;
        node = setup_node(pxm);
        if (node < 0) {
-               printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
                bad_srat();
                return;
        }
@@ -209,7 +215,6 @@ acpi_numa_processor_affinity_init(struct 
acpi_srat_cpu_affinity *pa)
        }
        node = setup_node(pxm);
        if (node < 0) {
-               printk(KERN_ERR "SRAT: Too many proximity domains %x\n", pxm);
                bad_srat();
                return;
        }
@@ -253,7 +258,6 @@ acpi_numa_memory_affinity_init(struct 
acpi_srat_mem_affinity *ma)
                pxm &= 0xff;
        node = setup_node(pxm);
        if (node < 0) {
-               printk(KERN_ERR "SRAT: Too many proximity domains.\n");
                bad_srat();
                return;
        }
@@ -295,7 +299,7 @@ acpi_numa_memory_affinity_init(struct 
acpi_srat_mem_affinity *ma)
 
 /* Sanity check to catch more bad SRATs (they are amazingly common).
    Make sure the PXMs cover all memory. */
-static int nodes_cover_memory(void)
+static int __init nodes_cover_memory(void)
 {
        int i;
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.5

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.