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 4/4] domain heap allocator changes - per domain addre

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH 4/4] domain heap allocator changes - per domain address restriction
From: "Jan Beulich" <jbeulich@xxxxxxxxxx>
Date: Wed, 07 Feb 2007 17:12:12 +0000
Delivery-date: Wed, 07 Feb 2007 09:14:36 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Introduce a per-domain field indicating the highest possible machine
address memory may be allocated for, and set it for compat domains to
be suitable for the limited m2p table size.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2007-02-07/xen/arch/x86/domain.c
===================================================================
--- 2007-02-07.orig/xen/arch/x86/domain.c       2007-02-01 17:41:08.000000000 
+0100
+++ 2007-02-07/xen/arch/x86/domain.c    2007-02-07 16:27:53.000000000 +0100
@@ -255,7 +255,7 @@ static void release_compat_l4(struct vcp
 
 static inline int may_switch_mode(struct domain *d)
 {
-    return 1; /* XXX */
+    return d->tot_pages == 0;
 }
 
 int switch_native(struct domain *d)
@@ -283,6 +283,8 @@ int switch_native(struct domain *d)
             release_compat_l4(d->vcpu[vcpuid]);
     }
 
+    d->pa_bitsize = 0;
+
     return 0;
 }
 
@@ -313,6 +315,9 @@ int switch_compat(struct domain *d)
             return -ENOMEM;
     }
 
+    d->pa_bitsize = fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+                    + (PAGE_SIZE - 2);
+
     return 0;
 }
 
Index: 2007-02-07/xen/arch/x86/domain_build.c
===================================================================
--- 2007-02-07.orig/xen/arch/x86/domain_build.c 2007-02-07 16:26:50.000000000 
+0100
+++ 2007-02-07/xen/arch/x86/domain_build.c      2007-02-07 16:27:53.000000000 
+0100
@@ -358,6 +358,8 @@ int construct_dom0(struct domain *d,
         value = (parms.virt_hv_start_low + mask) & ~mask;
 #ifdef CONFIG_COMPAT
         HYPERVISOR_COMPAT_VIRT_START(d) = max_t(unsigned int, 
m2p_compat_vstart, value);
+        d->pa_bitsize = fls((1UL << 32) - HYPERVISOR_COMPAT_VIRT_START(d)) - 1
+                        + (PAGE_SIZE - 2);
         if ( value > (!IS_COMPAT(d) ?
                       HYPERVISOR_VIRT_START :
                       __HYPERVISOR_COMPAT_VIRT_START) )
Index: 2007-02-07/xen/common/page_alloc.c
===================================================================
--- 2007-02-07.orig/xen/common/page_alloc.c     2007-02-07 16:26:50.000000000 
+0100
+++ 2007-02-07/xen/common/page_alloc.c  2007-02-07 16:27:53.000000000 +0100
@@ -718,7 +718,12 @@ struct page_info *__alloc_domheap_pages(
     if ( bits && bits <= PAGE_SHIFT + 1 )
         return NULL;
 
-    zone_hi = bits - PAGE_SHIFT - 1;
+#ifdef CONFIG_COMPAT
+    if ( d && d->pa_bitsize && bits > d->pa_bitsize )
+        zone_hi = d->pa_bitsize - PAGE_SHIFT - 1;
+    else
+#endif
+        zone_hi = bits - PAGE_SHIFT - 1;
     if ( zone_hi >= NR_ZONES )
         zone_hi = NR_ZONES - 1;
 
Index: 2007-02-07/xen/include/xen/sched.h
===================================================================
--- 2007-02-07.orig/xen/include/xen/sched.h     2007-01-30 10:23:31.000000000 
+0100
+++ 2007-02-07/xen/include/xen/sched.h  2007-02-07 16:27:53.000000000 +0100
@@ -165,6 +165,10 @@ struct domain
 
     unsigned long    domain_flags;
 
+#ifdef CONFIG_COMPAT
+    unsigned int     pa_bitsize;
+#endif
+
     /* Boolean: Is this an HVM guest? */
     char             is_hvm;
 



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH 4/4] domain heap allocator changes - per domain address restriction, Jan Beulich <=