From: Marcelo Tosatti <marcelo@kvack.org>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: Marcelo Tosatti <marcelo@kvack.org>,
kvm-devel <kvm-devel@lists.sourceforge.net>
Subject: Re: [PATCH] virtio-balloon: do not attempt to release more than available pages
Date: Sat, 8 Mar 2008 16:06:38 -0300 [thread overview]
Message-ID: <20080308190638.GA18152@dmt> (raw)
In-Reply-To: <200803060939.49302.rusty@rustcorp.com.au>
On Thu, Mar 06, 2008 at 09:39:48AM +1100, Rusty Russell wrote:
> On Thursday 06 March 2008 03:28:32 Marcelo Tosatti wrote:
> > Handle the case where the balloon target is larger than total ram size.
> >
> > BUG: unable to handle kernel paging request at 0000000000100100
> > IP: [<ffffffff881970f9>] :virtio_balloon:leak__balloon+0x2e/0xbe
> >
> > Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
>
> Hi Marcelo,
>
> My deepest concern is that we're papering over some real bug, if you
> tripped this. Zeroing num_pages makes sense as a hack, but we're clearly in
> trouble at this point and there should be some indication of that.
>
> If I may ask, how did this happen?
Rusty,
QEMU allows the user to set a target larger than the memory size which
the guest was booted with:
dev->num_pages = (ram_size - target) >> TARGET_PAGE_BITS;
virtio_notify_config(&dev->vdev);
num_pages goes negative, so driver attempts deflate back -num_pages from
its balloon.
There is no other bug here, its just a matter of guest driver being
fragile. You can avoid that condition in the host backend:
--- virtio-balloon.c.orig 2008-03-08 14:39:51.000000000 -0300
+++ virtio-balloon.c 2008-03-08 14:41:08.000000000 -0300
@@ -113,6 +113,8 @@
VirtIOBalloon *dev = opaque;
if (target) {
+ if (target > ram_size)
+ target = ram_size;
dev->num_pages = (ram_size - target) >> TARGET_PAGE_BITS;
virtio_notify_config(&dev->vdev);
}
But making the driver robust against it seems sensate. I agree that
zeroing num_pages is hackish. What do you suggest?
Thanks
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
next prev parent reply other threads:[~2008-03-08 19:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-05 16:28 [PATCH] virtio-balloon: do not attempt to release more than available pages Marcelo Tosatti
2008-03-05 16:59 ` Avi Kivity
2008-03-05 18:12 ` Marcelo Tosatti
2008-03-05 18:13 ` Avi Kivity
2008-03-05 18:43 ` Anthony Liguori
2008-03-05 19:39 ` Marcelo Tosatti
2008-03-05 19:42 ` Anthony Liguori
2008-03-06 7:06 ` Avi Kivity
2008-03-05 18:42 ` Anthony Liguori
2008-03-05 22:39 ` Rusty Russell
2008-03-08 19:06 ` Marcelo Tosatti [this message]
2008-03-11 0:26 ` Rusty Russell
2008-03-11 0:52 ` Anthony Liguori
2008-03-11 11:54 ` Rusty Russell
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=20080308190638.GA18152@dmt \
--to=marcelo@kvack.org \
--cc=kvm-devel@lists.sourceforge.net \
--cc=rusty@rustcorp.com.au \
/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