Xen 
 
Home About Xen.org Xen Xen Summit Wiki Mailing List Bug Tracker Xen Downloads
 
   
 

xen-devel

[Xen-devel] [xmtest PATCH] shadow_memory fix

To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [xmtest PATCH] shadow_memory fix
From: Rick Gonzalez <rcgneo@xxxxxxxxxx>
Date: Thu, 31 Aug 2006 15:13:33 -0500
Delivery-date: Thu, 31 Aug 2006 13:14:06 -0700
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
User-agent: Thunderbird 1.5.0.5 (Windows/20060719)
Team,

     attached is a patch to fix xmtest. This is for bug# 751.

What basically did was include the "shadow_memory" parameter in the HVM
config file with 8MB by default. This fixes the problem alone. Now, I
went further and created a function to grow this memory as needed.

The stipulation is that there should be 2KB of memory for every one MB
of RAM assigned to the guest domain, plus a few MB per vcpu ( ~2MB).

The 8MB of shadow memory is more than enough for xmtest when concerning
RAM. The my function grows this shadow memory if we have more than 3
vcpus. This is just a safety precaution. :)

Please look at the patch and let me know what you think.


regards,

Rick Gonzalez

diff -Naur xen-unstable.hg/tools/xm-test/lib/XmTestLib/XenDomain.py 
xen-unstable-shadowfix.hg/tools/xm-test/lib/XmTestLib/XenDomain.py
--- xen-unstable.hg/tools/xm-test/lib/XmTestLib/XenDomain.py    2006-08-31 
14:05:58.000000000 -0500
+++ xen-unstable-shadowfix.hg/tools/xm-test/lib/XmTestLib/XenDomain.py  
2006-08-31 14:38:45.000000000 -0500
@@ -74,6 +74,7 @@
                     }
 HVMDefaults =      {"memory"       : 64,
                     "vcpus"        : 1,
+                   "shadow_memory": 8,
                     "acpi"         : 0,
                     "apic"         : 0,
                     "disk"         : ["file:%s/disk.img,ioemu:%s,w!" %
@@ -169,6 +170,18 @@
         else:
             self.opts = self.defaultOpts
 
+    def computeShadowMem(self):
+        """Shadow Memory checking/assignment (for HVM domains only).
+            8MB by default. Minimum requirements for it is 2KB per every
+            1MB of RAM assigned to guest domain, plus a few more MB per vcpu.
+            8MB showld be enough but if vcpus is > 3, give 2MB more per 
vcpu."""
+
+        vcpus = self.getOpt("vcpus")
+        mem = self.getOpt("shadow_memory")
+        newmem = int(mem) + int(vcpus) * 2
+
+        return newmem
+
 class DomainError(Exception):
     def __init__(self, msg, extra="", errorcode=0):
         self.msg = msg
@@ -329,7 +342,6 @@
             return dev
         print "Device %s not found for domain %s" % (id, self.getName())
 
-
 class XmTestDomain(XenDomain):
 
     def __init__(self, name=None, extraConfig=None, baseConfig=configDefaults):
@@ -343,6 +355,10 @@
         if extraConfig:
             config.setOpts(extraConfig)
 
+       # if HVM enabled then check shadow memory
+        if ( ENABLE_HVM_SUPPORT ) and ( int(config.getOpt("vcpus")) > 3):
+            config.setOpt("shadow_memory",config.computeShadowMem())
+
         if name:
             config.setOpt("name", name)
         elif not config.getOpt("name"):

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [xmtest PATCH] shadow_memory fix, Rick Gonzalez <=