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][Patch] patch of memory allocation for domain restore

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC][Patch] patch of memory allocation for domain restore
From: geyi <kudva@xxxxxxxxxxxxxx>
Date: Fri, 17 Nov 2006 17:52:34 -0500
Delivery-date: Fri, 17 Nov 2006 14:52:19 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Thunderbird 1.5.0.8 (Windows/20061025)
Add _allocMem2 for domain restore.

--
Yi Ge <kudva@xxxxxxxxxxxxxx>
# HG changeset patch
# User gy@xxxxxxxxxxxxxxxxxxxxxxxxxxxx
# Date 1163803585 18000
# Node ID 8b64454006bbf0166b022728c1fc15b71fea426e
# Parent  b17300195f02f7da17f3ad94aed955863ffd4fed
[XenPPC] allocate memory for domain restore

Signed-off-by: Yi Ge <kudva@xxxxxxxxxxxxxx>
Signed-off-by: Dan E Poff <poff@xxxxxxxxxxxxxx>

diff -r b17300195f02 -r 8b64454006bb tools/python/xen/xend/XendDomainInfo.py
--- a/tools/python/xen/xend/XendDomainInfo.py   Tue Nov 14 19:46:26 2006 -0500
+++ b/tools/python/xen/xend/XendDomainInfo.py   Fri Nov 17 17:46:25 2006 -0500
@@ -1338,6 +1338,69 @@ class Common_XendDomainInfo:
     def allocMem(self):
         # only for PPC
         return
+    def _allocMem2(self):
+        # Use architecture- and image-specific calculations to determine
+        # the various headrooms necessary, given the raw configured
+        # values.
+        # reservation, maxmem, memory, and shadow are all in KiB.
+        log.debug("allocMem2");
+
+        maxmem = self.info['maxmem'] * 1024
+        memory = self.info['memory'] * 1024
+        shadow = self.info['shadow_memory'] * 1024
+
+        log.debug("maxmem: 0x%08x", maxmem)
+        log.debug("memory: 0x%08x  shadow: 0x%08x", memory, shadow)
+
+        # Round shadow up to a multiple of a MiB, as shadow_mem_control
+        # takes MiB and we must not round down and end up under-providing.
+        shadow = ((shadow + 1023) / 1024) * 1024
+
+        # set memory limit
+        xc.domain_setmaxmem(self.domid, maxmem)
+
+        # Make sure there's enough RAM available for the domain
+        balloon.free(memory + shadow)
+
+        # Set up the shadow memory, i.e. the PowerPC hash table
+        shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024)
+        self.info['shadow_memory'] = shadow_cur
+
+        rma_log = 26
+        ### self.info['powerpc_rma_log']
+        if rma_log == 0:
+            # use smallest RMA size available
+            rma_log = self.getRealModeLogs()[0]
+
+        if rma_log not in self.getRealModeLogs():
+            raise ValueError("rma_log(%d) must be one of" % rma_log,
+                             self.getRealModeLogs())
+
+#        self.info['powerpc_rma_log'] = rma_log # store info for FlatDeviceTree
+
+        rma_kb = (1 << rma_log) / 1024
+        if memory < rma_kb:
+            raise ValueError("Domain memory must be at least %d KB" % rma_kb)
+
+        if memory & (16 << 10):
+            raise ValueError("Domain memory %dKB must be a multiple of 16MB"
+                             % memory)
+
+        # allocate the RMA
+        log.debug("alloc_real_mode_area(%d, %d)", self.domid, rma_log)
+        xc.alloc_real_mode_area(self.domid, rma_log)
+
+        # now allocate the remaining memory as large-order allocations
+        memory -= rma_kb
+        extent_log = 24 # 16 MB
+        page_log = 12 # 4 KB
+        extent_order = extent_log - page_log
+        log.debug("increase_reservation(%d, 0x%x, %d)", self.domid,
+                  memory, extent_order)
+        xc.domain_memory_increase_reservation(self.domid,
+                                              memory,
+                                              extent_order)
+    ## public:
 
     def cleanupDomain(self):
         """Cleanup domain resources; release devices.  Idempotent.  Nothrow
_______________________________________________
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][Patch] patch of memory allocation for domain restore, geyi <=