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-ppc-devel

[XenPPC] [xenppc-unstable] [merge] null

# HG changeset patch
# User Jimi Xenidis <jimix@xxxxxxxxxxxxxx>
# Node ID 00c47d5766100994d1b936873629256874a8d5ba
# Parent  ff2c736fce49fedc8057d61f13df0a79ead22871
# Parent  b2f2c477895af973e727612a3967c68639a2b321
[merge] null
---
 tools/python/xen/xend/FlatDeviceTree.py |    2 -
 tools/python/xen/xend/XendDomainInfo.py |   45 ++++++++++++--------------------
 tools/python/xen/xend/arch.py           |   14 ++++-----
 tools/python/xen/xend/image.py          |   41 +++++++----------------------
 4 files changed, 35 insertions(+), 67 deletions(-)

diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/FlatDeviceTree.py
--- a/tools/python/xen/xend/FlatDeviceTree.py   Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/FlatDeviceTree.py   Wed Aug 23 05:49:29 2006 -0400
@@ -293,7 +293,7 @@ def build(imghandler):
     # identical...
     cpu0 = None
     def _nolinuxprops(fullpath):
-        return not os.path.basename(fullpath).startswith('linux,'):
+        return not os.path.basename(fullpath).startswith('linux,')
     for i in range(imghandler.vm.getVCpuCount()):
         cpu = cpus.addnode('PowerPC,970@0')
         _copytree(cpu, 'cpus/PowerPC,970@0', _nolinuxprops)
diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/XendDomainInfo.py   Wed Aug 23 05:49:29 2006 -0400
@@ -30,7 +30,6 @@ import time
 import time
 import threading
 import os
-import math
 
 import xen.lowlevel.xc
 from xen.util import asserts
@@ -1280,37 +1279,27 @@ class XendDomainInfo:
                 for v in range(0, self.info['max_vcpu_id']+1):
                     xc.vcpu_setaffinity(self.domid, v, self.info['cpus'])
 
-            # set domain maxmem in KiB
-            xc.domain_setmaxmem(self.domid, self.info['maxmem'] * 1024)
-
-            m = self.image.getDomainMemory(self.info['memory'] * 1024)
+            # set memory limit
+            maxmem = self.image.getRequiredMemory(self.info['maxmem'] * 1024)
+            xc.domain_setmaxmem(self.domid, maxmem)
+
+            mem_kb = self.image.getRequiredMemory(self.info['memory'] * 1024)
 
             # get the domain's shadow memory requirement
-            sm = int(math.ceil(self.image.getDomainShadowMemory(m) / 1024.0))
-            if self.info['shadow_memory'] > sm:
-                sm = self.info['shadow_memory']
+            shadow_kb = self.image.getRequiredShadowMemory(mem_kb)
+            shadow_kb_req = self.info['shadow_memory'] * 1024
+            if shadow_kb_req > shadow_kb:
+                shadow_kb = shadow_kb_req
 
             # Make sure there's enough RAM available for the domain
-            balloon.free(m + sm * 1024)
-
-            if os.uname()[4] in ('ppc64'):
-                self.info['shadow_memory'] = 0
-            else:
-                # Set up the shadow memory
-                sm = xc.shadow_mem_control(self.domid, mb=sm)
-                self.info['shadow_memory'] = sm
-
-            init_reservation = self.info['memory'] * 1024
-            if os.uname()[4] in ('ia64', 'ppc64'):
-                # Workaround for architectures that don't yet support
-                # ballooning.
-                init_reservation = m
-                # Following line from xiantao.zhang@xxxxxxxxx
-                # Needed for IA64 until supports ballooning -- okay for PPC64?
-                xc.domain_setmaxmem(self.domid, m)
-
-            xc.domain_memory_increase_reservation(self.domid, init_reservation,
-                                                  0, 0)
+            balloon.free(mem_kb + shadow_kb)
+
+            # Set up the shadow memory
+            shadow_cur = xc.shadow_mem_control(self.domid, shadow_kb * 1024)
+            self.info['shadow_memory'] = shadow_cur
+
+            # initial memory allocation
+            xc.domain_memory_increase_reservation(self.domid, mem_kb, 0, 0)
 
             self.createChannels()
 
diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/arch.py
--- a/tools/python/xen/xend/arch.py     Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/arch.py     Wed Aug 23 05:49:29 2006 -0400
@@ -20,12 +20,12 @@ import os
 import os
 
 _types = {
-       "i386": "x86",
-       "i486": "x86",
-       "i586": "x86",
-       "i686": "x86",
-       "ia64": "ia64",
-       "ppc": "powerpc",
-       "ppc64": "powerpc",
+    "i386": "x86",
+    "i486": "x86",
+    "i586": "x86",
+    "i686": "x86",
+    "ia64": "ia64",
+    "ppc": "powerpc",
+    "ppc64": "powerpc",
 }
 type = _types.get(os.uname()[4], "unknown")
diff -r ff2c736fce49 -r 00c47d576610 tools/python/xen/xend/image.py
--- a/tools/python/xen/xend/image.py    Wed Aug 23 05:44:46 2006 -0400
+++ b/tools/python/xen/xend/image.py    Wed Aug 23 05:49:29 2006 -0400
@@ -146,7 +146,7 @@ class ImageHandler:
     def getRequiredMemory(self, mem_kb):
         return mem_kb
 
-    def getDomainShadowMemory(self, mem_kb):
+    def getRequiredShadowMemory(self, mem_kb):
         """@return The minimum shadow memory required, in KiB, for a domain 
         with mem_kb KiB of RAM."""
         # PV domains don't need any shadow memory
@@ -197,10 +197,6 @@ class PPC_LinuxImageHandler(LinuxImageHa
     def configure(self, imageConfig, deviceConfig):
         LinuxImageHandler.configure(self, imageConfig, deviceConfig)
         self.imageConfig = imageConfig
-
-    def getDomainMemory(self, mem_kb):
-        """@see ImageHandler.getDomainMemory"""
-        return mem_kb
 
     def buildDomain(self):
         store_evtchn = self.vm.getStorePort()
@@ -382,32 +378,6 @@ class HVMImageHandler(ImageHandler):
         os.waitpid(self.pid, 0)
         self.pid = 0
 
-    def getDomainMemory(self, mem_kb):
-        """@see ImageHandler.getDomainMemory"""
-        if os.uname()[4] == 'ia64':
-            page_kb = 16
-            # ROM size for guest firmware, ioreq page and xenstore page
-            extra_pages = 1024 + 2
-        else:
-            page_kb = 4
-            # This was derived emperically:
-            #   2.4 MB overhead per 1024 MB RAM + 8 MB constant
-            #   + 4 to avoid low-memory condition
-            extra_mb = (2.4/1024) * (mem_kb/1024.0) + 12;
-            extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
-        return mem_kb + extra_pages * page_kb
-
-    def getDomainShadowMemory(self, mem_kb):
-        """@return The minimum shadow memory required, in KiB, for a domain 
-        with mem_kb KiB of RAM."""
-        if os.uname()[4] in ('ia64', 'ppc64'):
-            # Explicit shadow memory is not a concept 
-            return 0
-        else:
-            # 1MB per vcpu plus 4Kib/Mib of RAM.  This is higher than 
-            # the minimum that Xen would allocate if no value were given.
-            return 1024 * self.vm.getVCpuCount() + mem_kb / 256
-
     def register_shutdown_watch(self):
         """ add xen store watch on control/shutdown """
         self.shutdownWatch = xswatch(self.vm.dompath + "/control/shutdown", \
@@ -453,6 +423,10 @@ class IA64_HVM_ImageHandler(HVMImageHand
         # ROM size for guest firmware, ioreq page and xenstore page
         extra_pages = 1024 + 2
         return mem_kb + extra_pages * page_kb
+
+    def getRequiredShadowMemory(self, mem_kb):
+        # Explicit shadow memory is not a concept 
+        return 0
 
 class X86_HVM_ImageHandler(HVMImageHandler):
 
@@ -466,6 +440,11 @@ class X86_HVM_ImageHandler(HVMImageHandl
         extra_mb = (2.4/1024) * (mem_kb/1024.0) + 12;
         extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
         return mem_kb + extra_pages * page_kb
+
+    def getRequiredShadowMemory(self, mem_kb):
+        # 1MB per vcpu plus 4Kib/Mib of RAM.  This is higher than 
+        # the minimum that Xen would allocate if no value were given.
+        return 1024 * self.vm.getVCpuCount() + mem_kb / 256
 
 _handlers = {
     "powerpc": {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [xenppc-unstable] [merge] null, Xen patchbot-xenppc-unstable <=