From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Lalancette Subject: Re: [PATCH]: Xend: Balloon an additional 8MB for QEMU device model Date: Mon, 27 Aug 2007 14:45:54 -0400 Message-ID: <46D31BE2.60200@redhat.com> References: <46CF21AE.9030206@redhat.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060704020409000904000804" Return-path: In-Reply-To: <46CF21AE.9030206@redhat.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------060704020409000904000804 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Chris Lalancette wrote: > All, > Attached is a patch to make Xend balloon down an additional 8MB (for the > Cirrus logic video device) when doing a restore or migrate. Without this, you > can run into the following situation: All, Attached is an updated version of the patch. Dan Berrange correctly points out that this logic already exists in xend, when an HVM domain is being created; the logic just wasn't being used in the restore path. This patch basically takes the logic from the creation path and pulls it into the restore path, so things work properly. Again, this patch is against 3.1.0, but should apply fairly easily to unstable. Signed-off-by: Chris Lalancette --------------060704020409000904000804 Content-Type: text/x-patch; name="xen-3.1.0-xendcheckpoint-hvm-balloon.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="xen-3.1.0-xendcheckpoint-hvm-balloon.patch" --- xen-3.1.0-src/tools/python/xen/xend/XendCheckpoint.py.orig 2007-08-27 13:37:53.000000000 -0400 +++ xen-3.1.0-src/tools/python/xen/xend/XendCheckpoint.py 2007-08-27 14:14:19.000000000 -0400 @@ -18,6 +18,7 @@ import xen.util.auxbin import xen.lowlevel.xc import balloon +import image from XendError import XendError, VmError from XendLogging import log from XendDomainInfo import DEV_MIGRATE_STEP1, DEV_MIGRATE_STEP2 @@ -168,8 +169,6 @@ def restore(xd, fd, paused=False): assert store_port assert console_port - nr_pfns = (dominfo.getMemoryTarget() + 3) / 4 - # if hvm, pass mem size to calculate the store_mfn is_hvm = dominfo.is_hvm() if is_hvm: @@ -183,18 +182,32 @@ def restore(xd, fd, paused=False): pae = 0 try: - shadow = dominfo.info['shadow_memory'] + restore_image = image.create(dominfo, dominfo.info['image'], + dominfo.info['device']) + memory = restore_image.getRequiredAvailableMemory( + dominfo.info['memory'] * 1024) + maxmem = restore_image.getRequiredAvailableMemory( + dominfo.info['maxmem'] * 1024) + shadow = restore_image.getRequiredShadowMemory( + dominfo.info['shadow_memory'] * 1024, + dominfo.info['maxmem'] * 1024) + log.debug("restore:shadow=0x%x, _static_max=0x%x, _static_min=0x%x, ", dominfo.info['shadow_memory'], dominfo.info['maxmem'], dominfo.info['memory']) - balloon.free(xc.pages_to_kib(nr_pfns) + shadow * 1024) + # 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 - shadow_cur = xc.shadow_mem_control(dominfo.getDomid(), shadow) - dominfo.info['shadow_memory'] = shadow_cur + # set memory limit + xc.domain_setmaxmem(dominfo.getDomid(), maxmem) - xc.domain_setmaxmem(dominfo.getDomid(), dominfo.getMemoryMaximum()) + balloon.free(memory + shadow) + + shadow_cur = xc.shadow_mem_control(dominfo.getDomid(), shadow / 1024) + dominfo.info['shadow_memory'] = shadow_cur cmd = map(str, [xen.util.auxbin.pathTo(XC_RESTORE), fd, dominfo.getDomid(), @@ -206,7 +219,7 @@ def restore(xd, fd, paused=False): forkHelper(cmd, fd, handler.handler, True) # We don't want to pass this fd to any other children -- we - # might need to recover ths disk space that backs it. + # might need to recover the disk space that backs it. try: flags = fcntl.fcntl(fd, fcntl.F_GETFD) flags |= fcntl.FD_CLOEXEC --------------060704020409000904000804 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------060704020409000904000804--