From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=57713 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PAI8Z-0005k0-OD for qemu-devel@nongnu.org; Mon, 25 Oct 2010 04:10:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PAI8Y-0004Hc-6j for qemu-devel@nongnu.org; Mon, 25 Oct 2010 04:10:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:5657) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PAI8X-0004HS-St for qemu-devel@nongnu.org; Mon, 25 Oct 2010 04:10:34 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9P8AWqn019548 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 25 Oct 2010 04:10:32 -0400 Received: from redhat.com (vpn-6-113.tlv.redhat.com [10.35.6.113]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with SMTP id o9P8AUID010123 for ; Mon, 25 Oct 2010 04:10:31 -0400 Date: Mon, 25 Oct 2010 10:03:54 +0200 From: "Michael S. Tsirkin" Message-ID: <20101025080354.GA5438@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [PATCH] vhost: enable log before starting vq List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Log must be started before backend is enabled, to make sure no memory changes are untracked. Signed-off-by: Michael S. Tsirkin --- hw/vhost.c | 20 ++++++++++---------- 1 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hw/vhost.c b/hw/vhost.c index 8586f66..e0152e2 100644 --- a/hw/vhost.c +++ b/hw/vhost.c @@ -650,15 +650,6 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) r = -errno; goto fail_mem; } - for (i = 0; i < hdev->nvqs; ++i) { - r = vhost_virtqueue_init(hdev, - vdev, - hdev->vqs + i, - i); - if (r < 0) { - goto fail_vq; - } - } if (hdev->log_enabled) { hdev->log_size = vhost_get_log_size(hdev); @@ -671,11 +662,19 @@ int vhost_dev_start(struct vhost_dev *hdev, VirtIODevice *vdev) goto fail_log; } } + for (i = 0; i < hdev->nvqs; ++i) { + r = vhost_virtqueue_init(hdev, + vdev, + hdev->vqs + i, + i); + if (r < 0) { + goto fail_vq; + } + } hdev->started = true; return 0; -fail_log: fail_vq: while (--i >= 0) { vhost_virtqueue_cleanup(hdev, @@ -683,6 +682,7 @@ fail_vq: hdev->vqs + i, i); } +fail_log: fail_mem: fail_features: vdev->binding->set_guest_notifiers(vdev->binding_opaque, false); -- 1.7.3-rc1