From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c5GHw-00070x-4v for qemu-devel@nongnu.org; Fri, 11 Nov 2016 13:10:57 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c5GHv-0003he-6T for qemu-devel@nongnu.org; Fri, 11 Nov 2016 13:10:56 -0500 Received: from mail.kernel.org ([198.145.29.136]:52386) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c5GHu-0003h8-QI for qemu-devel@nongnu.org; Fri, 11 Nov 2016 13:10:54 -0500 Date: Fri, 11 Nov 2016 20:10:50 +0200 From: "Michael S. Tsirkin" Message-ID: <1478887767-31980-17-git-send-email-mst@redhat.com> References: <1478887767-31980-1-git-send-email-mst@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <1478887767-31980-1-git-send-email-mst@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 16/34] vhost: migration blocker only if shared log is used List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Rafael David Tinoco , =?iso-8859-1?Q?Marc-Andr=E9?= Lureau From: Rafael David Tinoco Commit 31190ed7 added a migration blocker in vhost_dev_init() to check if memfd would succeed. It is better if this blocker first checks if vhost backend requires shared log. This will avoid a situation where a blocker is added inappropriately (e.g. shared log allocation fails when vhost backend doesn't support it). Signed-off-by: Rafael David Tinoco Reviewed-by: Marc-Andr=E9 Lureau Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- hw/virtio/vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index 131f164..25bf67f 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -1122,7 +1122,7 @@ int vhost_dev_init(struct vhost_dev *hdev, void *op= aque, if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { error_setg(&hdev->migration_blocker, "Migration disabled: vhost lacks VHOST_F_LOG_ALL = feature."); - } else if (!qemu_memfd_check()) { + } else if (vhost_dev_log_is_shared(hdev) && !qemu_memfd_check())= { error_setg(&hdev->migration_blocker, "Migration disabled: failed to allocate shared me= mory"); } --=20 MST