From: Chris Lalancette <clalance@redhat.com>
To: xen-devel@lists.xensource.com
Subject: Re: [PATCH]: Xend: Balloon an additional 8MB for QEMU device model
Date: Mon, 27 Aug 2007 14:45:54 -0400 [thread overview]
Message-ID: <46D31BE2.60200@redhat.com> (raw)
In-Reply-To: <46CF21AE.9030206@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 712 bytes --]
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 <clalance@redhat.com>
[-- Attachment #2: xen-3.1.0-xendcheckpoint-hvm-balloon.patch --]
[-- Type: text/x-patch, Size: 2782 bytes --]
--- 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
[-- Attachment #3: Type: text/plain, Size: 138 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel
prev parent reply other threads:[~2007-08-27 18:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-24 18:21 [PATCH]: Xend: Balloon an additional 8MB for QEMU device model Chris Lalancette
2007-08-27 18:45 ` Chris Lalancette [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46D31BE2.60200@redhat.com \
--to=clalance@redhat.com \
--cc=xen-devel@lists.xensource.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.