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 3 of 5] x86: adjust the size of the e820 for pv guest

To: xen-devel@xxxxxxxxxxxxxxxxxxx, keir.fraser@xxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH 3 of 5] x86: adjust the size of the e820 for pv guest to be dynamic
From: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Date: Thu, 07 Apr 2011 16:25:24 -0400
Cc: konrad.wilk@xxxxxxxxxx
Delivery-date: Thu, 07 Apr 2011 13:53:17 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <patchbomb.1302207921@xxxxxxxxxxxxxxxxxxxxxxx>
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>
References: <patchbomb.1302207921@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mercurial-patchbomb/1.8.1
# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
# Date 1302203926 14400
# Node ID 546d8a03d5cbe0ceddadf701174f2417a0b72891
# Parent  01d0d338b97491a3aa816dab43cc709a234214f7
x86: adjust the size of the e820 for pv guest to be dynamic.

Instead of using the E820MAX we will use the amount of
E820 entries on the machine, plus the number three.

Considering the use cases, which is the toolstack retrieving
the E820, sanitizing it, and then setting it for the PV guest
(for PCI passthrough), this dynamic number of E820 is just
right.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>

diff -r 01d0d338b974 -r 546d8a03d5cb xen/arch/x86/domain.c
--- a/xen/arch/x86/domain.c     Thu Apr 07 14:58:17 2011 -0400
+++ b/xen/arch/x86/domain.c     Thu Apr 07 15:18:46 2011 -0400
@@ -636,13 +636,13 @@
                 d->arch.emuirq_pirq[i] = IRQ_UNBOUND;
         } else
         {
-          d->arch.pv_domain.e820 = xmalloc_array(struct e820entry, E820MAX);
+          d->arch.pv_domain.e820 = xmalloc_array(struct e820entry, E820NR);
 
           if ( !d->arch.pv_domain.e820 )
             goto fail;
 
           memset(d->arch.pv_domain.e820, 0,
-                E820MAX * sizeof(*d->arch.pv_domain.e820));
+                 E820NR * sizeof(*d->arch.pv_domain.e820));
         }
 
         if ( (rc = iommu_domain_init(d)) != 0 )
diff -r 01d0d338b974 -r 546d8a03d5cb xen/arch/x86/mm.c
--- a/xen/arch/x86/mm.c Thu Apr 07 14:58:17 2011 -0400
+++ b/xen/arch/x86/mm.c Thu Apr 07 15:18:46 2011 -0400
@@ -4710,7 +4710,7 @@
         if ( copy_from_guest(&fmap, arg, 1) )
             return -EFAULT;
 
-        if ( fmap.map.nr_entries > E820MAX )
+        if ( fmap.map.nr_entries > E820NR )
             return -EINVAL;
 
         rc = rcu_lock_target_domain_by_id(fmap.domid, &d);
diff -r 01d0d338b974 -r 546d8a03d5cb xen/include/asm-x86/e820.h
--- a/xen/include/asm-x86/e820.h        Thu Apr 07 14:58:17 2011 -0400
+++ b/xen/include/asm-x86/e820.h        Thu Apr 07 15:18:46 2011 -0400
@@ -39,4 +39,6 @@
 #define e820_raw bootsym(e820map)
 #define e820_raw_nr bootsym(e820nr)
 
+/* The +3 is for guest RAM entries */
+#define E820NR (e820.nr_map + 3)
 #endif /*__E820_HEADER*/



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