From: Andrew Jones Subject: [PATCH kvm-unit-tests v2 1/8] virtio-mmio: fix queue allocation Date: Wed, 7 Feb 2018 20:34:08 +0100 Message-ID: <20180207193408.21332-1-drjones@redhat.com> References: <20180207190334.16516-2-drjones@redhat.com> Cc: pbonzini@redhat.com, rkrcmar@redhat.com To: kvm@vger.kernel.org Return-path: Received: from mx3-rdu2.redhat.com ([66.187.233.73]:39830 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754002AbeBGTeL (ORCPT ); Wed, 7 Feb 2018 14:34:11 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 171C0400187D for ; Wed, 7 Feb 2018 19:34:11 +0000 (UTC) In-Reply-To: <20180207190334.16516-2-drjones@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Ensure we clear the queue memory we get from alloc_pages(). Otherwise QEMU gets angry when we attempt to migrate a unit test as the used vring index is corrupted by the page allocator's next page link. Signed-off-by: Andrew Jones --- lib/virtio-mmio.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/virtio-mmio.c b/lib/virtio-mmio.c index e5e8f660b5cd..57fe78ecbb6c 100644 --- a/lib/virtio-mmio.c +++ b/lib/virtio-mmio.c @@ -56,6 +56,7 @@ static struct virtqueue *vm_setup_vq(struct virtio_device *vdev, vq = calloc(1, sizeof(*vq)); assert(VIRTIO_MMIO_QUEUE_SIZE_MIN <= 2*PAGE_SIZE); queue = alloc_pages(1); + memset(queue, 0, 2*PAGE_SIZE); assert(vq && queue); writel(index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); -- 2.13.6