]> xenbits.xensource.com Git - xen.git/commitdiff
xen/arm: Correctly report the memory region in the dummy NUMA helpers
authorJulien Grall <julien.grall@arm.com>
Fri, 6 Oct 2017 13:22:47 +0000 (15:22 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 6 Oct 2017 13:22:47 +0000 (15:22 +0200)
NUMA is currently not supported on Arm. Because common code is
NUMA-aware, dummy helpers are instead provided to expose a single node.

Those helpers are for instance used to know the region to scrub.

However the memory region is not reported correctly. Indeed, the
frametable may not be at the beginning of the memory and there might be
multiple memory banks. This will lead to not scrub some part of the
memory.

The memory information can be found using:
    * first_valid_mfn as the start of the memory
    * max_page - first_valid_mfn as the spanned pages

Note that first_valid_mfn is now been exported. The prototype has been
added in asm-arm/numa.h and not in a common header because I would
expect the variable to become static once NUMA is fully supported on
Arm.

This is XSA-245.

Signed-off-by: Julien Grall <julien.grall@arm.com>
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reported-and-Tested-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
master commit: 5414ba7f5e1ffc88ed2758b1e1b14bbfd3536a61
master date: 2017-09-29 13:23:11 -0700

xen/common/page_alloc.c
xen/include/asm-arm/numa.h

index 92d9c14f0615358461a88e23707709b37fae2ecc..b2e86967775d45379a443595b69456d52f8ad5d1 100644 (file)
@@ -90,7 +90,11 @@ PAGE_LIST_HEAD(page_broken_list);
  * BOOT-TIME ALLOCATOR
  */
 
-static unsigned long __initdata first_valid_mfn = ~0UL;
+/*
+ * first_valid_mfn is exported because it is use in ARM specific NUMA
+ * helpers. See comment in asm-arm/numa.h.
+ */
+unsigned long first_valid_mfn = ~0UL;
 
 static struct bootmem_region {
     unsigned long s, e; /* MFNs @s through @e-1 inclusive are free */
index 6f72b653831e67fe7c192f355ac411f652dba484..c2f997bf4ee3cee77f960dba50597f0c5bb94608 100644 (file)
@@ -10,9 +10,15 @@ static inline __attribute__((pure)) int phys_to_nid(paddr_t addr)
     return 0;
 }
 
+/*
+ * TODO: make first_valid_mfn static when NUMA is supported on Arm, this
+ * is required because the dummy helpers are using it.
+ */
+extern unsigned long first_valid_mfn;
+
 /* XXX: implement NUMA support */
-#define node_spanned_pages(nid) (total_pages)
-#define node_start_pfn(nid) (pdx_to_pfn(frametable_base_pdx))
+#define node_spanned_pages(nid) (max_page - first_valid_mfn)
+#define node_start_pfn(nid) (first_valid_mfn)
 #define __node_distance(a, b) (20)
 
 static inline unsigned int arch_get_dma_bitsize(void)