From nobody Tue May 13 18:51:28 2025 Delivered-To: importer2@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1677256855; cv=none; d=zohomail.com; s=zohoarc; b=WW8DYpKHJdOYB9cwwLuoiI+APxqxcVz0n+EGXbzUei6Bj1kGYTsaRn/m5tCikZkKVFj6jiOjKhgXXkWIedsIHZiuUlGcGEZSFomNZjE1IvVQwbO5pSU4CNVf+9+OauXc5O+kDvjnj9h5OsKdCoOB/fGhvan2+UfoOenNtdZ6MzU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677256855; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=SFD1vTTGC6UTS0PaRXRY/vLSg/9vBPQI5vC68s4t4Ko=; b=l7QMnl9CFAlxPz5Q36NRvZUTyCDNOqIZMqufoKjH2qgG4vzrn4gShaese24Tsjo77aE3lF+ycb4mpNXoM3fwwe2Xu/g+6DrLU5fx4F5PtLGA4LCaRT+rqWqUZ/aesQcsDv6WBcWrIqRz4eUrakNzCXyM/N+Wpw7oNb4M6l/uuqM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer2=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 167725685569034.926724319335676; Fri, 24 Feb 2023 08:40:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pVaQA-0005vc-8v; Fri, 24 Feb 2023 10:55:42 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVaPv-0005gy-Bg for qemu-devel@nongnu.org; Fri, 24 Feb 2023 10:55:33 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pVaPt-0005uH-IG for qemu-devel@nongnu.org; Fri, 24 Feb 2023 10:55:27 -0500 Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-330-DaTjsdxwMQG2qFcJXlXAxw-1; Fri, 24 Feb 2023 10:55:20 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ABFA33C02528; Fri, 24 Feb 2023 15:55:19 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.192.85]) by smtp.corp.redhat.com (Postfix) with ESMTP id C8D6AC15BA0; Fri, 24 Feb 2023 15:55:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677254124; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SFD1vTTGC6UTS0PaRXRY/vLSg/9vBPQI5vC68s4t4Ko=; b=i/5Jjy9W9BJWaqRbdptiBsGBGJIi9KVS8O61N+uDNtufB7ztUu4BCFRzzVIaxZnYQIn5TX Fwt5FTPPg3ZaHDQ6VJfSTw4keQ+7cK4dyVAlyPi6Wd1Q4a0O2N9JULfPEAPqKnRuzJmpHg AHM8mROLsJRHH4syFXtLMbuuEBpJSiI= X-MC-Unique: DaTjsdxwMQG2qFcJXlXAxw-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Stefano Garzarella , Shannon Nelson , Jason Wang , Gautam Dawar , Laurent Vivier , alvaro.karsz@solid-run.com, longpeng2@huawei.com, virtualization@lists.linux-foundation.org, Stefan Hajnoczi , Cindy Lu , "Michael S. Tsirkin" , si-wei.liu@oracle.com, Liuxiangdong , Parav Pandit , Eli Cohen , Zhu Lingshan , Harpreet Singh Anand , "Gonglei (Arei)" , Lei Yang Subject: [PATCH v4 11/15] vdpa net: block migration if the device has CVQ Date: Fri, 24 Feb 2023 16:54:34 +0100 Message-Id: <20230224155438.112797-12-eperezma@redhat.com> In-Reply-To: <20230224155438.112797-1-eperezma@redhat.com> References: <20230224155438.112797-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer2=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=eperezma@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer2=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer2=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1677256857760100003 Devices with CVQ needs to migrate state beyond vq state. Leaving this to future series. Signed-off-by: Eugenio P=C3=A9rez --- v3: Migration blocker is registered in vhost_dev. --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 1 + net/vhost-vdpa.c | 9 +++++++++ 3 files changed, 11 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 4a7d396674..c278a2a8de 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -50,6 +50,7 @@ typedef struct vhost_vdpa { const VhostShadowVirtqueueOps *shadow_vq_ops; void *shadow_vq_ops_opaque; struct vhost_dev *dev; + Error *migration_blocker; VhostVDPAHostNotifier notifier[VIRTIO_QUEUE_MAX]; } VhostVDPA; =20 diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 27655e7582..25b64ae854 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -438,6 +438,7 @@ static int vhost_vdpa_init(struct vhost_dev *dev, void = *opaque, Error **errp) v->msg_type =3D VHOST_IOTLB_MSG_V2; vhost_vdpa_init_svq(dev, v); =20 + error_propagate(&dev->migration_blocker, v->migration_blocker); if (!vhost_vdpa_first_dev(dev)) { return 0; } diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index c5512ddf10..4f983df000 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -828,6 +828,15 @@ static NetClientState *net_vhost_vdpa_init(NetClientSt= ate *peer, =20 s->vhost_vdpa.shadow_vq_ops =3D &vhost_vdpa_net_svq_ops; s->vhost_vdpa.shadow_vq_ops_opaque =3D s; + + /* + * TODO: We cannot migrate devices with CVQ as there is no way to = set + * the device state (MAC, MQ, etc) before starting datapath. + * + * Migration blocker ownership now belongs to v + */ + error_setg(&s->vhost_vdpa.migration_blocker, + "net vdpa cannot migrate with CVQ feature"); } ret =3D vhost_vdpa_add(nc, (void *)&s->vhost_vdpa, queue_pair_index, n= vqs); if (ret) { --=20 2.31.1