From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Juergen Gross <jgross@suse.com>,
linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: hw42@ipsumj.de, stable@vger.kernel.org
Subject: Re: [PATCH] xen: fix booting ballooned down hvm guest
Date: Tue, 24 Oct 2017 10:33:07 -0400 [thread overview]
Message-ID: <554ab545-5e74-29c8-0eb7-5db1dcbeb6bb@oracle.com> (raw)
In-Reply-To: <20171024081050.2441-1-jgross@suse.com>
On 10/24/2017 04:10 AM, Juergen Gross wrote:
> Commit 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don't
> online new memory initially") introduced a regression when booting a
> HVM domain with memory less than mem-max: instead of ballooning down
> immediately the system would try to use the memory up to mem-max
> resulting in Xen crashing the domain.
>
> For HVM domains the current size will be reflected in Xenstore node
> memory/static-max instead of memory/target.
>
> Additionally we have to trigger the ballooning process at once.
>
> Cc: <stable@vger.kernel.org> # 4.13
> Fixes: 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don't
> online new memory initially")
>
> Suggested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Signed-off-by: Juergen Gross <jgross@suse.com>
Reported-by: HW42 <hw42@ipsumj.de>
> ---
> drivers/xen/xen-balloon.c | 18 ++++++++++++------
> 1 file changed, 12 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
> index e89136ab851e..3745748d9644 100644
> --- a/drivers/xen/xen-balloon.c
> +++ b/drivers/xen/xen-balloon.c
> @@ -57,7 +57,7 @@ static int register_balloon(struct device *dev);
> static void watch_target(struct xenbus_watch *watch,
> const char *path, const char *token)
> {
> - unsigned long long new_target;
> + unsigned long long new_target, static_max;
> int err;
> static bool watch_fired;
> static long target_diff;
> @@ -72,13 +72,19 @@ static void watch_target(struct xenbus_watch *watch,
> * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
> */
> new_target >>= PAGE_SHIFT - 10;
> - if (watch_fired) {
> - balloon_set_new_target(new_target - target_diff);
> - return;
> +
> + if (!watch_fired) {
> + watch_fired = true;
> + err = xenbus_scanf(XBT_NIL, "memory", "static-max", "%llu",
> + &static_max);
> + if (err != 1)
> + static_max = new_target;
> + static_max >>= PAGE_SHIFT - 10;
if you set static_max to new_target you've already done the shift,
haven't you?
> + target_diff = xen_pv_domain() ? 0
Why do we special-case PV?
-boris
> + : static_max - balloon_stats.target_pages;
> }
>
> - watch_fired = true;
> - target_diff = new_target - balloon_stats.target_pages;
> + balloon_set_new_target(new_target - target_diff);
> }
> static struct xenbus_watch target_watch = {
> .node = "memory/target",
next prev parent reply other threads:[~2017-10-24 14:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-24 8:10 Juergen Gross
2017-10-24 14:33 ` Boris Ostrovsky [this message]
2017-10-24 14:41 ` Juergen Gross
2017-10-24 14:56 ` Boris Ostrovsky
2017-10-24 14:58 ` Juergen Gross
2017-10-24 14:59 ` HW42
2017-10-24 15:01 ` Juergen Gross
2017-10-25 2:21 ` Willy Tarreau
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=554ab545-5e74-29c8-0eb7-5db1dcbeb6bb@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=hw42@ipsumj.de \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®