From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51543) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZQy6-0000IM-P7 for qemu-devel@nongnu.org; Mon, 15 Aug 2016 19:06:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bZQy0-0002kI-O6 for qemu-devel@nongnu.org; Mon, 15 Aug 2016 19:06:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:53704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bZQy0-0002kE-I7 for qemu-devel@nongnu.org; Mon, 15 Aug 2016 19:06:48 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3840AC0AF3B6 for ; Mon, 15 Aug 2016 23:06:48 +0000 (UTC) Date: Tue, 16 Aug 2016 00:32:55 +0300 From: "Michael S. Tsirkin" Message-ID: <1471296770-7984-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] virtio-balloon: stats vq migration spec compliance List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ladi Prosek virtio spec says that devices must not touch VQs before DRIVER_OK is set. Additionally, balloon must not touch stats VQ unless the stats feature bit has been negotiated. Cc: Ladi Prosek Signed-off-by: Michael S. Tsirkin --- hw/virtio/virtio-balloon.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c index 65457e9..7189260 100644 --- a/hw/virtio/virtio-balloon.c +++ b/hw/virtio/virtio-balloon.c @@ -427,6 +427,7 @@ static void virtio_balloon_vmstate_cb(void *opaque, int running, RunState state) { VirtIOBalloon *s = opaque; + VirtIODevice *vdev = VIRTIO_DEVICE(s); if (!running) { /* put the stats element back if the VM is not running */ @@ -436,7 +437,8 @@ static void virtio_balloon_vmstate_cb(void *opaque, int running, s->stats_vq_elem = NULL; } - } else { + } else if (balloon_stats_supported(s) && + (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { /* poll stats queue for the element we may have discarded * when the VM was stopped */ virtio_balloon_receive_stats(VIRTIO_DEVICE(s), s->svq); -- MST