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

[Xen-changelog] [xen-3.4-testing] x86 numa: Fix SRAT check for discontig

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.4-testing] x86 numa: Fix SRAT check for discontig memory
From: "Xen patchbot-3.4-testing" <patchbot-3.4-testing@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 03 Sep 2009 05:10:35 -0700
Delivery-date: Thu, 03 Sep 2009 05:15:54 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1251968635 -3600
# Node ID 334ae37dddf4802198d6fd36773f88f7f33eb9ad
# Parent  b1d3e2067b3c8d7946fa9fbafe62a36524cbfd69
x86 numa: Fix SRAT check for discontig memory

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>
xen-unstable changeset:   20120:50a5950e6a24
xen-unstable date:        Tue Aug 25 14:58:42 2009 +0100

x86/numa: fix c/s 20120 (Fix SRAT check for discontig memory)

That change converted the (wrong) assumption of contiguous nodes'
memory to a similarly wrong one of assuming discontiguous memory (i.e.
each node having separate E820 table entries). The code ought to be
able to deal with both, though, and I hope this change makes it so.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
Acked-by: Alex Williamson <alex.williamson@xxxxxx>
xen-unstable changeset:   20136:27b3bd0a47fd
xen-unstable date:        Mon Aug 31 10:10:17 2009 +0100
---
 xen/arch/x86/srat.c |   51 ++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 34 insertions(+), 17 deletions(-)

diff -r b1d3e2067b3c -r 334ae37dddf4 xen/arch/x86/srat.c
--- a/xen/arch/x86/srat.c       Thu Sep 03 10:02:43 2009 +0100
+++ b/xen/arch/x86/srat.c       Thu Sep 03 10:03:55 2009 +0100
@@ -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;
@@ -217,23 +218,39 @@ static int nodes_cover_memory(void)
 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;
-       }
-
-       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;
+
+       for (i = 0; i < e820.nr_map; i++) {
+               int j, found;
+               unsigned long long start, end;
+
+               if (e820.map[i].type != E820_RAM) {
+                       continue;
+               }
+
+               start = e820.map[i].addr;
+               end = e820.map[i].addr + e820.map[i].size - 1;
+
+               do {
+                       found = 0;
+                       for_each_node_mask(j, nodes_parsed)
+                               if (start < nodes[j].end
+                                   && end > nodes[j].start) {
+                                       if (start >= nodes[j].start) {
+                                               start = nodes[j].end;
+                                               found = 1;
+                                       }
+                                       if (end <= nodes[j].end) {
+                                               end = nodes[j].start;
+                                               found = 1;
+                                       }
+                               }
+               } while (found && start < end);
+
+               if (start < end) {
+                       printk(KERN_ERR "SRAT: No PXM for e820 range: "
+                               "%016Lx - %016Lx\n", start, end);
+                       return 0;
+               }
        }
        return 1;
 }

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.4-testing] x86 numa: Fix SRAT check for discontig memory, Xen patchbot-3.4-testing <=