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][P2M] check whether hap mode is enabled before using

To: "'xen-devel@xxxxxxxxxxxxxxxxxxx'" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Chris Lalancette <clalance@xxxxxxxxxx>, "Sarathy, Bhavna" <Bhavna.Sarathy@xxxxxxx>
Subject: [Xen-devel] [PATCH][P2M] check whether hap mode is enabled before using 2mb pages
From: Wei Huang <wei.huang2@xxxxxxx>
Date: Thu, 18 Jun 2009 15:51:30 -0500
Cc:
Delivery-date: Thu, 18 Jun 2009 13:52:09 -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>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 2.0.0.17 (X11/20080914)
This small patch checks whether hap mode is enabled when guest is trying to allocate 2MB pages inside P2M. This prevents potential errors when hap is disabled.

Cc: Chris Lalancette <clalance@xxxxxxxxxx>
Cc: Sarathy, Bhavna <Bhavna.Sarathy@xxxxxxx>
Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>



diff -r 55ca7ef865b4 xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c     Tue Jun 16 11:01:17 2009 +0100
+++ b/xen/arch/x86/mm/p2m.c     Thu Jun 18 13:07:10 2009 -0500
@@ -1499,7 +1499,11 @@ int set_p2m_entry(struct domain *d, unsi
 
     while ( todo )
     {
-        order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0;
+        if ( is_hvm_domain(d) && d->arch.hvm_domain.hap_enabled )
+            order = (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ?
+                9 : 0;
+        else
+            order = 0;
         rc = d->arch.p2m->set_entry(d, gfn, mfn, order, p2mt);
         gfn += 1ul << order;
         if ( mfn_x(mfn) != INVALID_MFN )
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH][P2M] check whether hap mode is enabled before using 2mb pages, Wei Huang <=