[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [xmtest PATCH] shadow_memory fix


  • To: Xen Developers <xen-devel@xxxxxxxxxxxxxxxxxxx>
  • From: Rick Gonzalez <rcgneo@xxxxxxxxxx>
  • Date: Thu, 31 Aug 2006 15:13:33 -0500
  • Delivery-date: Thu, 31 Aug 2006 13:14:06 -0700
  • List-id: Xen developer discussion <xen-devel.lists.xensource.com>

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

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.