From patchwork Thu Oct 1 17:23:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marc-Andr=C3=A9_Lureau?= X-Patchwork-Id: 525233 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 278C5140D6E for ; Fri, 2 Oct 2015 04:22:23 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=bgaxwurb; dkim-atps=neutral Received: from localhost ([::1]:55034 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhiUn-0006RX-1f for incoming@patchwork.ozlabs.org; Thu, 01 Oct 2015 14:22:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhhb4-0008FX-TH for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:24:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhhb3-0000Hf-Um for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:24:46 -0400 Received: from mail-qg0-x22a.google.com ([2607:f8b0:400d:c04::22a]:33381) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhhb3-0000HK-Mw for qemu-devel@nongnu.org; Thu, 01 Oct 2015 13:24:45 -0400 Received: by qgev79 with SMTP id v79so73258762qge.0 for ; Thu, 01 Oct 2015 10:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=C4AXdy7LGZ84gpxKVvcfaOESEgZuAd8rTcoqaTCDtvU=; b=bgaxwurbPUFAoYDq49COrHIEkoJnP23Z/Mj5QtJHBJGJqAmq/54zzDeU3xRUerccBR 1kFc45jYuEzQLWyFIWzfBNLwsxxQGPqSrf6BYyiCT/Gj/ccB1TtdvAJZKo4QabJov1eg Muf+RGNiMqBFrAaQFqpGbdIRW6TEy2j2AzKx4kauJ6itLXgSehfTlPdnypYFUooaXBD/ cKT5eiMSjEMIySO/Xpxzm9zzTgosqZsy74WDIHPjcAmPtb0+zOWBSGcjfXFrV9fAvq+l Esv5ieKQ3dzETQqn+5sZe4txCmYdFDcUpDRZC0ws56ukYvT18Uo3bGFs+7zRv4jBotWN Azeg== X-Received: by 10.140.106.226 with SMTP id e89mr13701641qgf.84.1443720285416; Thu, 01 Oct 2015 10:24:45 -0700 (PDT) Received: from localhost (bne75-h02-31-39-163-232.dsl.sta.abo.bbox.fr. [31.39.163.232]) by smtp.gmail.com with ESMTPSA id o65sm2786847qhb.21.2015.10.01.10.24.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Oct 2015 10:24:44 -0700 (PDT) From: marcandre.lureau@redhat.com To: qemu-devel@nongnu.org Date: Thu, 1 Oct 2015 19:23:55 +0200 Message-Id: <1443720248-15482-12-git-send-email-marcandre.lureau@redhat.com> X-Mailer: git-send-email 2.4.3 In-Reply-To: <1443720248-15482-1-git-send-email-marcandre.lureau@redhat.com> References: <1443720248-15482-1-git-send-email-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c04::22a Cc: haifeng.lin@huawei.com, mst@redhat.com, thibaut.collet@6wind.com, jasowang@redhat.com, pbonzini@redhat.com, =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Subject: [Qemu-devel] [PATCH v7 11/24] vhost-user: add a migration blocker X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Marc-André Lureau If VHOST_USER_PROTOCOL_F_LOG_SHMFD is not announced, block vhost-user migration. The blocker is removed in vhost_dev_cleanup(). Signed-off-by: Marc-André Lureau --- hw/virtio/vhost-user.c | 9 +++++++++ hw/virtio/vhost.c | 16 ++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c index cf14e38..f1edd04 100644 --- a/hw/virtio/vhost-user.c +++ b/hw/virtio/vhost-user.c @@ -15,6 +15,7 @@ #include "qemu/error-report.h" #include "qemu/sockets.h" #include "exec/ram_addr.h" +#include "migration/migration.h" #include #include @@ -442,6 +443,14 @@ static int vhost_user_init(struct vhost_dev *dev, void *opaque) } } + if (dev->migration_blocker == NULL && + !virtio_has_feature(dev->protocol_features, + VHOST_USER_PROTOCOL_F_LOG_SHMFD)) { + error_setg(&dev->migration_blocker, + "Migration disabled: vhost-user backend lacks " + "VHOST_USER_PROTOCOL_F_LOG_SHMFD feature."); + } + return 0; } diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c index d1c0367..554e49d 100644 --- a/hw/virtio/vhost.c +++ b/hw/virtio/vhost.c @@ -944,6 +944,8 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, uint64_t features; int i, r; + hdev->migration_blocker = NULL; + if (vhost_set_backend_type(hdev, backend_type) < 0) { close((uintptr_t)opaque); return -1; @@ -987,12 +989,18 @@ int vhost_dev_init(struct vhost_dev *hdev, void *opaque, .eventfd_del = vhost_eventfd_del, .priority = 10 }; - hdev->migration_blocker = NULL; - if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { - error_setg(&hdev->migration_blocker, - "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."); + + if (hdev->migration_blocker == NULL) { + if (!(hdev->features & (0x1ULL << VHOST_F_LOG_ALL))) { + error_setg(&hdev->migration_blocker, + "Migration disabled: vhost lacks VHOST_F_LOG_ALL feature."); + } + } + + if (hdev->migration_blocker != NULL) { migrate_add_blocker(hdev->migration_blocker); } + hdev->mem = g_malloc0(offsetof(struct vhost_memory, regions)); hdev->n_mem_sections = 0; hdev->mem_sections = NULL;