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-devel

[Xen-devel] [PATCH] Fix SRAT check for discontig memory

To: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] Fix SRAT check for discontig memory
From: Alex Williamson <alex.williamson@xxxxxx>
Date: Mon, 24 Aug 2009 15:20:57 -0600
Cc: Keir Fraser <keir.fraser@xxxxxxxxxx>
Delivery-date: Mon, 24 Aug 2009 14:21:28 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Organization: HP OSLO R&D
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
We currently compare the sum of the pages found in the SRAT table to the
address of the highest memory page found via the e820 table to validate
the SRAT.  This is completely bogus if there's any kind of discontiguous
memory, where the sum of the pages could be much smaller than the
address of the highest page.  I think all that's necessary is to
validate that each usable memory range in the e820 is covered by an SRAT
entry.  This might not be the most efficient way to do it, but there are
usually a relatively small number of entries on each side.

Signed-off-by: Alex Williamson <alex.williamson@xxxxxx>
--

I also propose this for the stable branches.

diff -r c5125c0ea051 xen/arch/x86/srat.c
--- a/xen/arch/x86/srat.c       Mon Aug 24 08:27:30 2009 +0100
+++ b/xen/arch/x86/srat.c       Mon Aug 24 15:19:34 2009 -0600
@@ -17,6 +17,7 @@
 #include <xen/nodemask.h>
 #include <xen/acpi.h>
 #include <xen/numa.h>
+#include <asm/e820.h>
 #include <asm/page.h>
 
 static struct acpi_table_slit *acpi_slit;
@@ -236,23 +237,31 @@
 static int nodes_cover_memory(void)
 {
        int i;
-       u64 pxmram, e820ram;
 
-       pxmram = 0;
-       for_each_node_mask(i, nodes_parsed) {
-               u64 s = nodes[i].start >> PAGE_SHIFT;
-               u64 e = nodes[i].end >> PAGE_SHIFT;
-               pxmram += e - s;
-       }
+       for (i = 0; i < e820.nr_map; i++) {
+               int j, found;
+               unsigned long long start, end;
 
-       e820ram = max_page;
-       /* We seem to lose 3 pages somewhere. Allow a bit of slack. */
-       if ((long)(e820ram - pxmram) >= 1*1024*1024) {
-               printk(KERN_ERR "SRAT: PXMs only cover %"PRIu64"MB of your %"
-                       PRIu64"MB e820 RAM. Not used.\n",
-                       (pxmram << PAGE_SHIFT) >> 20,
-                       (e820ram << PAGE_SHIFT) >> 20);
-               return 0;
+               if (e820.map[i].type != E820_RAM) {
+                       continue;
+               }
+
+               start = e820.map[i].addr;
+               end = e820.map[i].addr + e820.map[i].size - 1;
+
+               found = 0;
+               for_each_node_mask(j, nodes_parsed) {
+                       if (start >= nodes[j].start && end <= nodes[j].end) {
+                               found = 1;
+                               break;
+                       }
+               }
+
+               if (!found) {
+                       printk(KERN_ERR "SRAT: No PXM for e820 range: "
+                               "%016Lx - %016Lx\n", start, end);
+                       return 0;
+               }
        }
        return 1;
 }



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix SRAT check for discontig memory, Alex Williamson <=