mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
[HVM] Move shadow initialisation into domain-creation hypercall.
Allocate HVM guest memory in the libxc builder function rather than in xend. Clean up fall out from these changes. Todo: Fix ia64. Move PV builder to same model (it should allocate the memory rather than xend doing so -- then it can avoid using xc_get_pfn_list()). Signed-off-by: Keir Fraser <keir@xensource.com>
This commit is contained in:
1 parent
8bdc427fa2
commit
8082f8f784
8 files changed
+64
-164
No files matched your search
@@ -1295,9 +1295,11 @@ class XendDomainInfo:
|
||||
shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024)
|
||||
self.info['shadow_memory'] = shadow_cur
|
||||
|
||||
# initial memory reservation
|
||||
xc.domain_memory_increase_reservation(self.domid, reservation, 0,
|
||||
0)
|
||||
# Initial memory reservation
|
||||
if not (self._infoIsSet('image') and
|
||||
sxp.name(self.info['image']) == "hvm"):
|
||||
xc.domain_memory_increase_reservation(
|
||||
self.domid, reservation, 0, 0)
|
||||
|
||||
self._createChannels()
|
||||
|
||||
|
||||
@@ -478,22 +478,12 @@ class X86_HVM_ImageHandler(HVMImageHandler):
|
||||
|
||||
def getRequiredAvailableMemory(self, mem_kb):
|
||||
# Add 8 MiB overhead for QEMU's video RAM.
|
||||
return self.getRequiredInitialReservation(mem_kb) + 8192
|
||||
return mem_kb + 8192
|
||||
|
||||
def getRequiredInitialReservation(self, mem_kb):
|
||||
page_kb = 4
|
||||
# This was derived emperically:
|
||||
# 2.4 MB overhead per 1024 MB RAM
|
||||
# + 4 to avoid low-memory condition
|
||||
extra_mb = (2.4/1024) * (mem_kb/1024.0) + 4;
|
||||
extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
|
||||
return mem_kb + extra_pages * page_kb
|
||||
return mem_kb
|
||||
|
||||
def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
|
||||
# The given value is the configured value -- we need to include the
|
||||
# overhead due to getRequiredInitialReservation.
|
||||
maxmem_kb = self.getRequiredInitialReservation(maxmem_kb)
|
||||
|
||||
# 256 pages (1MB) per vcpu,
|
||||
# plus 1 page per MiB of RAM for the P2M map,
|
||||
# plus 1 page per MiB of RAM to shadow the resident processes.
|
||||
|
||||