From: Amit Shah <amit.shah@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: qemu list <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 5/7] balloon: Separate out stat and balloon handling
Date: Sat, 23 Jul 2011 08:40:03 +0530 [thread overview]
Message-ID: <20110723031003.GA14493@amit-x200.redhat.com> (raw)
In-Reply-To: <m37h7aidb0.fsf@blackfin.pond.sub.org>
On (Fri) 22 Jul 2011 [16:45:55], Markus Armbruster wrote:
> Amit Shah <amit.shah@redhat.com> writes:
>
> > Passing on '0' as ballooning target to indicate retrieval of stats is
> > bad API. It also makes 'balloon 0' in the monitor cause a segfault.
> > Have two different functions handle the different functionality instead.
> >
> > Reported-by: Mike Cao <bcao@redhat.com>
> > Signed-off-by: Amit Shah <amit.shah@redhat.com>
>
> Can you explain the fault? It's not obvious to me...
There's a bt at:
https://bugzilla.redhat.com/show_bug.cgi?id=694378
The callback is populated when called via 'info balloon', where some
detail is printed on the monitor after the guest responds with the
current balloon info.
On the other hand, 'balloon X' just updates the balloon size; with no
information to be printed. When 'balloon 0' is issued,
virtio_balloon_to_target() thinks it is the 'info balloon' command,
gets info from the guest, and then tries to call the monitor callback
to print the info it got... and segfaults.
> > --- a/hw/virtio-balloon.c
> > +++ b/hw/virtio-balloon.c
> > @@ -227,8 +227,7 @@ static void virtio_balloon_stat(void *opaque, MonitorCompletion cb,
> > complete_stats_request(dev);
> > }
> >
> > -static void virtio_balloon_to_target(void *opaque, ram_addr_t target,
> > - MonitorCompletion cb, void *cb_data)
> > +static void virtio_balloon_to_target(void *opaque, ram_addr_t target)
> > {
> > VirtIOBalloon *dev = opaque;
> >
> > @@ -238,8 +237,6 @@ static void virtio_balloon_to_target(void *opaque, ram_addr_t target,
> > if (target) {
> > dev->num_pages = (ram_size - target) >> VIRTIO_BALLOON_PFN_SHIFT;
> > virtio_notify_config(&dev->vdev);
> > - } else {
> > - virtio_balloon_stat(opaque, cb, cb_data);
> > }
> > }
> >
>
> Special case: do nothing when target == 0. Is that necessary/
Why make a round trip to the guest when we're doing nothing?
Amit
next prev parent reply other threads:[~2011-07-23 3:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-20 8:35 [Qemu-devel] [PATCH 0/7] balloon: cleanups, fix segfault Amit Shah
2011-07-20 8:45 ` [Qemu-devel] [PATCH 1/7] balloon: Make functions, local vars static Amit Shah
2011-07-20 8:45 ` [Qemu-devel] [PATCH 2/7] balloon: Add braces around if statements Amit Shah
2011-07-20 8:45 ` [Qemu-devel] [PATCH 3/7] balloon: Simplify code flow Amit Shah
2011-07-20 8:45 ` [Qemu-devel] [PATCH 4/7] virtio-balloon: Separate status handling into separate function Amit Shah
2011-07-20 8:45 ` [Qemu-devel] [PATCH 5/7] balloon: Separate out stat and balloon handling Amit Shah
2011-07-22 14:45 ` Markus Armbruster
2011-07-23 3:10 ` Amit Shah [this message]
2011-07-25 14:11 ` Markus Armbruster
2011-07-20 8:45 ` [Qemu-devel] [PATCH 6/7] balloon: Fix header comment; add Copyright Amit Shah
2011-07-20 8:45 ` [Qemu-devel] [PATCH 7/7] virtio-balloon: " Amit Shah
2011-07-25 14:13 ` [Qemu-devel] [PATCH 0/7] balloon: cleanups, fix segfault Markus Armbruster
2011-07-25 15:49 ` Amit Shah
-- strict thread matches above, loose matches on Subject: below --
2011-07-26 9:08 [Qemu-devel] [PULL 0/7] virtio-balloon: cleanups, fix segfault from use-after-free Amit Shah
2011-07-26 9:08 ` [Qemu-devel] [PATCH 5/7] balloon: Separate out stat and balloon handling Amit Shah
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=20110723031003.GA14493@amit-x200.redhat.com \
--to=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).