From nobody Tue Feb 10 14:32:14 2026 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (209.51.188.17 [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549558937134211.7862410992949; Thu, 7 Feb 2019 09:02:17 -0800 (PST) Received: from localhost ([127.0.0.1]:43436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grn3x-0000bo-4L for importer@patchew.org; Thu, 07 Feb 2019 12:02:09 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44172) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grmzF-0005Ju-G9 for qemu-devel@nongnu.org; Thu, 07 Feb 2019 11:57:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grmzD-0004Cb-RW for qemu-devel@nongnu.org; Thu, 07 Feb 2019 11:57:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47688) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grmzD-0004C7-Hz for qemu-devel@nongnu.org; Thu, 07 Feb 2019 11:57:15 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C58B540F30 for ; Thu, 7 Feb 2019 16:57:14 +0000 (UTC) Received: from localhost (unknown [10.36.112.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2F279379D; Thu, 7 Feb 2019 16:57:04 +0000 (UTC) From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= To: qemu-devel@nongnu.org Date: Thu, 7 Feb 2019 17:54:49 +0100 Message-Id: <20190207165449.6125-13-marcandre.lureau@redhat.com> In-Reply-To: <20190207165449.6125-1-marcandre.lureau@redhat.com> References: <20190207165449.6125-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Feb 2019 16:57:14 +0000 (UTC) Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH v2 12/12] RFC: add explicit can_migrate to vhost_user_backend_dev_init() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= , Gerd Hoffmann , "Michael S. Tsirkin" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" In general, there is not much support for migrating a vhost-user slave process. Many virtio devices however implement vmsd, and the vhost-user instances (as child objects) may be migrated. Since there is no other support at this point, the slave is assumed to be state less (outside of VM state), or using a migration method outside of qemu migration stream. Since this is not well specified, add a common blocker for the VhostUserBackend users (vhost-user-input and upcoming gpu will use it). RFC since I am not sure that's what Michael had in mind when requesting such blocker. Signed-off-by: Marc-Andr=C3=A9 Lureau --- include/sysemu/vhost-user-backend.h | 2 +- backends/vhost-user.c | 7 ++++++- hw/input/vhost-user-input.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/include/sysemu/vhost-user-backend.h b/include/sysemu/vhost-use= r-backend.h index 60f811cae7..feb331288f 100644 --- a/include/sysemu/vhost-user-backend.h +++ b/include/sysemu/vhost-user-backend.h @@ -53,7 +53,7 @@ struct VhostUserBackend { }; =20 int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, - unsigned nvqs, Error **errp); + unsigned nvqs, bool can_migrate, Error **e= rrp); void vhost_user_backend_start(VhostUserBackend *b); void vhost_user_backend_stop(VhostUserBackend *b); =20 diff --git a/backends/vhost-user.c b/backends/vhost-user.c index bf39c0751d..4e0af8952a 100644 --- a/backends/vhost-user.c +++ b/backends/vhost-user.c @@ -30,7 +30,7 @@ ioeventfd_enabled(void) =20 int vhost_user_backend_dev_init(VhostUserBackend *b, VirtIODevice *vdev, - unsigned nvqs, Error **errp) + unsigned nvqs, bool can_migrate, Error **errp) { int ret; =20 @@ -49,6 +49,11 @@ vhost_user_backend_dev_init(VhostUserBackend *b, VirtIOD= evice *vdev, b->dev.nvqs =3D nvqs; b->dev.vqs =3D g_new(struct vhost_virtqueue, nvqs); =20 + if (!can_migrate && !b->dev.migration_blocker) { + error_setg(&b->dev.migration_blocker, + "Migration disabled: vhost-user device can't migrate"); + } + ret =3D vhost_dev_init(&b->dev, &b->vhost_user, VHOST_BACKEND_TYPE_USE= R, 0); if (ret < 0) { error_setg_errno(errp, -ret, "vhost initialization failed"); diff --git a/hw/input/vhost-user-input.c b/hw/input/vhost-user-input.c index ef1b23a8b2..360a2ff618 100644 --- a/hw/input/vhost-user-input.c +++ b/hw/input/vhost-user-input.c @@ -24,7 +24,7 @@ static void vhost_input_realize(DeviceState *dev, Error *= *errp) return; } =20 - if (vhost_user_backend_dev_init(vhi->vhost, vdev, 2, errp) =3D=3D -1) { + if (vhost_user_backend_dev_init(vhi->vhost, vdev, 2, false, errp) =3D= =3D -1) { return; } =20 --=20 2.20.1.519.g8feddda32c