qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Liang Li <liang.z.li@intel.com>, qemu-devel@nongnu.org
Cc: "Michael S. Tsirkin" <mst@redhat.com>, Ladi Prosek <lprosek@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] balloon: Fix failure of updating guest memory status
Date: Thu, 30 Jun 2016 16:35:27 +0200	[thread overview]
Message-ID: <eaaebc52-2a58-b92c-0055-9384fddc2ecc@redhat.com> (raw)
In-Reply-To: <1467271903-23812-1-git-send-email-liang.z.li@intel.com>



On 30/06/2016 09:31, Liang Li wrote:
> After live migration, 'guest-stats' can't get the expected memory
> status in the guest. This issue is caused by commit 4eae2a657d.
> The value of 's->stats_vq_elem' will be NULL after live migration,
> and the check in the function 'balloon_stats_poll_cb()' will
> prevent the 'virtio_notify()' from executing. So guest will not
> update the memory status.
> 
> Signed-off-by: Liang Li <liang.z.li@intel.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Ladi Prosek <lprosek@redhat.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  hw/virtio/virtio-balloon.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
> index 557d3f9..cc6947f 100644
> --- a/hw/virtio/virtio-balloon.c
> +++ b/hw/virtio/virtio-balloon.c
> @@ -98,13 +98,19 @@ static void balloon_stats_poll_cb(void *opaque)
>  {
>      VirtIOBalloon *s = opaque;
>      VirtIODevice *vdev = VIRTIO_DEVICE(s);
> +    VirtQueueElement elem = {0};
>  
> -    if (s->stats_vq_elem == NULL || !balloon_stats_supported(s)) {
> +    if (!balloon_stats_supported(s)) {
>          /* re-schedule */
>          balloon_stats_change_timer(s, s->stats_poll_interval);
>          return;
>      }
>  
> +    if (s->stats_vq_elem == NULL) {
> +        virtqueue_push(s->svq, &elem, 0);
> +        virtio_notify(vdev, s->svq);
> +        return;
> +    }
>      virtqueue_push(s->svq, s->stats_vq_elem, s->stats_vq_offset);
>      virtio_notify(vdev, s->svq);
>      g_free(s->stats_vq_elem);
> 

Hi, the right fix is to migrate s->stats_vq_elem if it is not NULL.  See
how it's done in hw/char/virtio-serial.c's virtio_serial_save_device
(save) and fetch_active_ports_list (load).

Paolo

  parent reply	other threads:[~2016-06-30 14:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-30  7:31 [Qemu-devel] [PATCH] balloon: Fix failure of updating guest memory status Liang Li
2016-06-30  8:11 ` Ladi Prosek
2016-06-30  8:39   ` Li, Liang Z
2016-06-30  9:09     ` Ladi Prosek
2016-06-30 16:43       ` Li, Liang Z
2016-06-30 14:35 ` Paolo Bonzini [this message]
2016-06-30 16:58   ` Li, Liang Z
2016-07-01  8:43   ` Li, Liang Z

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=eaaebc52-2a58-b92c-0055-9384fddc2ecc@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=liang.z.li@intel.com \
    --cc=lprosek@redhat.com \
    --cc=mst@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).