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

[xen staging] x86: initialize memnodemapsize while faking NUMA node



commit 728998f6f2b7e1420e771236efec65cbf6143b7b
Author:     Wei Chen <wei.chen@xxxxxxx>
AuthorDate: Fri Sep 24 11:02:20 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Sep 24 11:02:20 2021 +0200

    x86: initialize memnodemapsize while faking NUMA node
    
    When system turns NUMA off or system lacks of NUMA support,
    Xen will fake a NUMA node to make system works as a single
    node NUMA system.
    
    In this case the memory node map doesn't need to be allocated
    from boot pages, it will use the _memnodemap directly. But
    memnodemapsize hasn't been set. Xen should assert in phys_to_nid.
    Because x86 was using an empty macro "VIRTUAL_BUG_ON" to replace
    ASSERT, this bug will not be triggered on x86.
    
    Actually, Xen will only use 1 slot of memnodemap in this case.
    So we set memnodemap[0] to 0 and memnodemapsize to 1 in this
    patch to fix it.
    
    Signed-off-by: Wei Chen <wei.chen@xxxxxxx>
    Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
---
 xen/arch/x86/numa.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/xen/arch/x86/numa.c b/xen/arch/x86/numa.c
index f1066c59c7..ce79ee44ce 100644
--- a/xen/arch/x86/numa.c
+++ b/xen/arch/x86/numa.c
@@ -270,6 +270,10 @@ void __init numa_initmem_init(unsigned long start_pfn, 
unsigned long end_pfn)
     /* setup dummy node covering all memory */
     memnode_shift = BITS_PER_LONG - 1;
     memnodemap = _memnodemap;
+    /* Dummy node only uses 1 slot in reality */
+    memnodemap[0] = 0;
+    memnodemapsize = 1;
+
     nodes_clear(node_online_map);
     node_set_online(0);
     for ( i = 0; i < nr_cpu_ids; i++ )
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

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