From patchwork Fri Jul 28 17:20:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E5B06C0015E for ; Fri, 28 Jul 2023 17:23:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR8x-0001Oo-3B; Fri, 28 Jul 2023 13:20:47 -0400 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 1qPR8s-0001K6-V7 for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:43 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR8r-0008Mb-Bj for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564840; 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=0AuE379vW/co2hmkYkUf0b8G8fUUpmfbw1dIONIw/9Q=; b=VMiA+eHgMVfGS6XdNapohF9Euc7zk8q3GWh8NC4+QAa1mR3thXrwrERn1pYVqVpU4lJfyG zCtX4LvsjQ7yy+BL/zVihIYKdKLgy+pWa63BD40h/iqgWtcQW63bcS075pEsjHbtcyugZu COTOo0cRGR77dMTgbb6SdbTFSiI8W6A= Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-335-3mufYBFUPlW_-FfjBB4SQw-1; Fri, 28 Jul 2023 13:20:36 -0400 X-MC-Unique: 3mufYBFUPlW_-FfjBB4SQw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 87B941C0513E; Fri, 28 Jul 2023 17:20:35 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 50C01111F3B0; Fri, 28 Jul 2023 17:20:33 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 1/7] vdpa: export vhost_vdpa_set_vring_ready Date: Fri, 28 Jul 2023 19:20:22 +0200 Message-Id: <20230728172028.2074052-2-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.129.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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org The vhost-vdpa net backend needs to enable vrings in a different order than default, so export it. No functional change intended except for tracing, that now includes the (virtio) index being enabled and the return value of the ioctl. Still ignoring return value of this function if called from vhost_vdpa_dev_start, as reorganize calling code around it is out of the scope of this series. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 1 + hw/virtio/vhost-vdpa.c | 28 ++++++++++++++++++++-------- hw/virtio/trace-events | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index e64bfc7f98..5407d54fd7 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -57,6 +57,7 @@ typedef struct vhost_vdpa { } VhostVDPA; int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_range); +int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, unsigned idx); int vhost_vdpa_dma_map(struct vhost_vdpa *v, uint32_t asid, hwaddr iova, hwaddr size, void *vaddr, bool readonly); diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 42f2a4bae9..bebcc9fe7c 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -532,6 +532,19 @@ int vhost_vdpa_get_iova_range(int fd, struct vhost_vdpa_iova_range *iova_range) return ret < 0 ? -errno : 0; } +int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, unsigned idx) +{ + struct vhost_dev *dev = v->dev; + struct vhost_vring_state state = { + .index = idx, + .num = 1, + }; + int r = vhost_vdpa_call(dev, VHOST_VDPA_SET_VRING_ENABLE, &state); + + trace_vhost_vdpa_set_vring_ready(dev, idx, r); + return r; +} + /* * The use of this function is for requests that only need to be * applied once. Typically such request occurs at the beginning @@ -876,16 +889,15 @@ static int vhost_vdpa_get_vq_index(struct vhost_dev *dev, int idx) return idx; } -static int vhost_vdpa_set_vring_ready(struct vhost_dev *dev) +static int vhost_vdpa_set_vrings_ready(struct vhost_dev *dev) { + struct vhost_vdpa *v = dev->opaque; int i; - trace_vhost_vdpa_set_vring_ready(dev); + + assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA); + for (i = 0; i < dev->nvqs; ++i) { - struct vhost_vring_state state = { - .index = dev->vq_index + i, - .num = 1, - }; - vhost_vdpa_call(dev, VHOST_VDPA_SET_VRING_ENABLE, &state); + vhost_vdpa_set_vring_ready(v, dev->vq_index + i); } return 0; } @@ -1298,7 +1310,7 @@ static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started) if (unlikely(!ok)) { return -1; } - vhost_vdpa_set_vring_ready(dev); + vhost_vdpa_set_vrings_ready(dev); } else { vhost_vdpa_suspend(dev); vhost_vdpa_svqs_stop(dev); diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 7109cf1a3b..1cb9027d1e 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -48,7 +48,7 @@ vhost_vdpa_set_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRI vhost_vdpa_get_device_id(void *dev, uint32_t device_id) "dev: %p device_id %"PRIu32 vhost_vdpa_reset_device(void *dev) "dev: %p" vhost_vdpa_get_vq_index(void *dev, int idx, int vq_idx) "dev: %p idx: %d vq idx: %d" -vhost_vdpa_set_vring_ready(void *dev) "dev: %p" +vhost_vdpa_set_vring_ready(void *dev, unsigned i, int r) "dev: %p, idx: %u, r: %d" vhost_vdpa_dump_config(void *dev, const char *line) "dev: %p %s" vhost_vdpa_set_config(void *dev, uint32_t offset, uint32_t size, uint32_t flags) "dev: %p offset: %"PRIu32" size: %"PRIu32" flags: 0x%"PRIx32 vhost_vdpa_get_config(void *dev, void *config, uint32_t config_len) "dev: %p config: %p config_len: %"PRIu32 From patchwork Fri Jul 28 17:20:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3C7EEC001DE for ; Fri, 28 Jul 2023 17:44:46 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR8w-0001Np-FC; Fri, 28 Jul 2023 13:20:46 -0400 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 1qPR8u-0001N9-BX for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:44 -0400 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 1qPR8t-0008NU-0t for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564842; 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=s1mv7uzcPXcJ81XaXK92RJXYFUYLlxlqghXDFZnxUMI=; b=T2hQhqckcpgHr3NWyKQsoAjXPKEOizNpivKdZRpXGAHNljmj3f32ByCrf0KG0KrSeG95ZU zrACnM/0lZshqF0Hls3De0uRxmu5hRlAHfqz28F75Xo84tkqr3F9ailL3FNgZI6w7TK8b6 C/o57CEAb2Z14ffvu/ghdUQLA3yAPwY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-552-Q4i4enrrM5OeHy9A3OZL2A-1; Fri, 28 Jul 2023 13:20:38 -0400 X-MC-Unique: Q4i4enrrM5OeHy9A3OZL2A-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EA3F858EED; Fri, 28 Jul 2023 17:20:38 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id C97DC1121330; Fri, 28 Jul 2023 17:20:35 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 2/7] vdpa: add should_enable op Date: Fri, 28 Jul 2023 19:20:23 +0200 Message-Id: <20230728172028.2074052-3-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To restore the device at the destination of a live migration we send the commands through control virtqueue. For a device to read CVQ it must have received the DRIVER_OK status bit. However this opens a window where the device could start receiving packets in rx queue 0 before it receives the RSS configuration. To avoid that, we will not send vring_enable until all configuration is used by the device. As a first step, enable a new vitio ops per vhost_vdpa device to know if we should enable a virtqueue or not. This srtuct can be reused in the future to add more actions to vhost_vdpa that depend on the virtIO kind of device. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/hw/virtio/vhost-vdpa.h b/include/hw/virtio/vhost-vdpa.h index 5407d54fd7..3d330d439a 100644 --- a/include/hw/virtio/vhost-vdpa.h +++ b/include/hw/virtio/vhost-vdpa.h @@ -30,6 +30,13 @@ typedef struct VhostVDPAHostNotifier { void *addr; } VhostVDPAHostNotifier; +struct vhost_vdpa; +typedef bool (*vhost_vdpa_virtio_should_enable_op)(const struct vhost_vdpa *v); + +typedef struct VhostVDPAVirtIOOps { + vhost_vdpa_virtio_should_enable_op should_enable; +} VhostVDPAVirtIOOps; + typedef struct vhost_vdpa { int device_fd; int index; @@ -48,6 +55,7 @@ typedef struct vhost_vdpa { VhostIOVATree *iova_tree; GPtrArray *shadow_vqs; const VhostShadowVirtqueueOps *shadow_vq_ops; + const VhostVDPAVirtIOOps *virtio_ops; void *shadow_vq_ops_opaque; struct vhost_dev *dev; Error *migration_blocker; From patchwork Fri Jul 28 17:20:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332573 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 3361DC04FE0 for ; Fri, 28 Jul 2023 18:39:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR8z-0001X9-LS; Fri, 28 Jul 2023 13:20:49 -0400 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 1qPR8x-0001PH-Tj for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:47 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR8w-0008OU-KI for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564846; 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=fJnf01bbsUf53Izrt6GXdJzd9ID7pODZMAOQ02cP6nc=; b=RgangJO+ouG9UUZpsws2SaADqS3V2UrAPOLgGgB6ACylku+pB0qJCU6oWslbQB2CLSZdqh TUIThYWqe6LfKE2oZzOg71ju1JLG4BrCZnyXawPXsMYun7yf7Z7WbkMjyVy7uva9PeJRF/ 8cV74g0e5BxHL9tit1tkuolX7B23nE0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-487-qhkVz3lDO8ailwr81Z_qRQ-1; Fri, 28 Jul 2023 13:20:42 -0400 X-MC-Unique: qhkVz3lDO8ailwr81Z_qRQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 355E6805C3F; Fri, 28 Jul 2023 17:20:42 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EBB11121330; Fri, 28 Jul 2023 17:20:38 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 3/7] vdpa: use virtio_ops->should_enable at vhost_vdpa_set_vrings_ready Date: Fri, 28 Jul 2023 19:20:24 +0200 Message-Id: <20230728172028.2074052-4-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.129.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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org This allow to skip some rings that qemu does not want to enable. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index bebcc9fe7c..1281502a71 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -896,6 +896,11 @@ static int vhost_vdpa_set_vrings_ready(struct vhost_dev *dev) assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_VDPA); + if (v->virtio_ops && v->virtio_ops->should_enable + && !(v->virtio_ops->should_enable(v))) { + return 0; + } + for (i = 0; i < dev->nvqs; ++i) { vhost_vdpa_set_vring_ready(v, dev->vq_index + i); } From patchwork Fri Jul 28 17:20:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 99DA8C0015E for ; Fri, 28 Jul 2023 18:21:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR93-0001Zf-8A; Fri, 28 Jul 2023 13:20:53 -0400 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 1qPR91-0001ZF-UO for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:51 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR90-0008TP-Es for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564849; 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=HxuunUKvDmqwi3/RPgyAnob3gvg7QBjSxcGz824Vq1g=; b=BcKm4o+tSaNE3TRODp5CRBMhnuY20zpTL17ARxOs2oX0BzZNChVwmUvwuO0jC/TJpwDOmi z5Zq3+yEthQ32dIM6bN4Gq4tBIYjm6kFq1imhXBPFoSon/YWDruzXVTt/RrhV2m1tJqwPS Z6Sae979/WooXALxYXuZjNSezA8XwnY= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-553-VLNSlhkTP8S-yisbYSri1g-1; Fri, 28 Jul 2023 13:20:45 -0400 X-MC-Unique: VLNSlhkTP8S-yisbYSri1g-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id ACD5D803FDC; Fri, 28 Jul 2023 17:20:44 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 763211121330; Fri, 28 Jul 2023 17:20:42 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 4/7] vdpa: add stub vhost_vdpa_should_enable Date: Fri, 28 Jul 2023 19:20:25 +0200 Message-Id: <20230728172028.2074052-5-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.129.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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To restore the device at the destination of a live migration we send the commands through control virtqueue. For a device to read CVQ it must have received the DRIVER_OK status bit. However this opens a window where the device could start receiving packets in rx queue 0 before it receives the RSS configuration. To avoid that, we will not send vring_enable until all configuration is used by the device. Add vhost-vdpa net vhost_vdpa_should_enable. Do not change the behavior in this commit, only introduce the op. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 9795306742..3d7dc3e5c0 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -1255,6 +1255,15 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops = { .avail_handler = vhost_vdpa_net_handle_ctrl_avail, }; +static bool vhost_vdpa_should_enable(const struct vhost_vdpa *v) +{ + return true; +} + +static const VhostVDPAVirtIOOps vhost_vdpa_virtio_net_ops = { + .should_enable = vhost_vdpa_should_enable, +}; + /** * Probe if CVQ is isolated * @@ -1378,6 +1387,7 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.shadow_vqs_enabled = svq; s->vhost_vdpa.iova_range = iova_range; s->vhost_vdpa.shadow_data = svq; + s->vhost_vdpa.virtio_ops = &vhost_vdpa_virtio_net_ops; if (queue_pair_index == 0) { vhost_vdpa_net_valid_svq_features(features, &s->vhost_vdpa.migration_blocker); From patchwork Fri Jul 28 17:20:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332574 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5CC28C04FDF for ; Fri, 28 Jul 2023 18:39:31 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR94-0001aY-Qn; Fri, 28 Jul 2023 13:20:54 -0400 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 1qPR93-0001Ze-4W for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:53 -0400 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 1qPR91-00009U-MG for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564851; 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=SsZLuDbr8hKAlocP8fEDhU4P8chzoS8FDIBSDERk4N8=; b=dac8VJlrCwZPS1g2SY79U7+haZQPUl8zntI62oEK5ECEkomiQHZu7hGBLwWUH725qgrH8d vozb0jHmygZVaM0GfLJEdsgN8EWnHz1DoRrzt8dwcGv5JBbBGj+3kvamivktMIRN8R97Mt LRnaVR4XpixXz5F3lBlaVSavwthAo2A= Received: from mimecast-mx02.redhat.com (66.187.233.73 [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-682-VWUAtlpeMwq7sv7Ct-ub3Q-1; Fri, 28 Jul 2023 13:20:47 -0400 X-MC-Unique: VWUAtlpeMwq7sv7Ct-ub3Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 302543C0D84C; Fri, 28 Jul 2023 17:20:47 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id ED9741121330; Fri, 28 Jul 2023 17:20:44 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 5/7] vdpa: delay enable of data vqs Date: Fri, 28 Jul 2023 19:20:26 +0200 Message-Id: <20230728172028.2074052-6-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org To restore the device at the destination of a live migration we send the commands through control virtqueue. For a device to read CVQ it must have received the DRIVER_OK status bit. However this opens a window where the device could start receiving packets in rx queue 0 before it receives the RSS configuration. To avoid that, we do not send vring_enable until all configuration is used by the device. Signed-off-by: Eugenio Pérez --- v2: Enable the dataplane vqs if cannot shadow CVQ because of device features or ASID. --- net/vhost-vdpa.c | 44 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 3d7dc3e5c0..2c1cfda657 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -283,6 +283,15 @@ static VhostVDPAState *vhost_vdpa_net_first_nc_vdpa(VhostVDPAState *s) return DO_UPCAST(VhostVDPAState, nc, nc0); } +/** From any vdpa net client, get the netclient of the last queue pair */ +static VhostVDPAState *vhost_vdpa_net_last_nc_vdpa(VhostVDPAState *s) +{ + VirtIONet *n = qemu_get_nic_opaque(s->nc.peer); + NetClientState *nc = qemu_get_peer(n->nic->ncs, n->max_ncs - 1); + + return DO_UPCAST(VhostVDPAState, nc, nc); +} + static void vhost_vdpa_net_log_global_enable(VhostVDPAState *s, bool enable) { struct vhost_vdpa *v = &s->vhost_vdpa; @@ -996,6 +1005,13 @@ static int vhost_vdpa_net_load(NetClientState *nc) return r; } + for (int i = 0; i < v->dev->vq_index; ++i) { + r = vhost_vdpa_set_vring_ready(v, i); + if (unlikely(r)) { + return r; + } + } + return 0; } @@ -1255,9 +1271,35 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_svq_ops = { .avail_handler = vhost_vdpa_net_handle_ctrl_avail, }; +/** + * Check if a vhost_vdpa device should enable before DRIVER_OK + * + * CVQ must always start first if we want to restore the state safely. Do not + * start data vqs if the device has CVQ. + */ static bool vhost_vdpa_should_enable(const struct vhost_vdpa *v) { - return true; + struct vhost_dev *dev = v->dev; + VhostVDPAState *s = container_of(v, VhostVDPAState, vhost_vdpa); + VhostVDPAState *cvq_s = vhost_vdpa_net_last_nc_vdpa(s); + + if (!(dev->vq_index_end % 2)) { + /* vDPA device does not have CVQ */ + return true; + } + + if (dev->vq_index + 1 == dev->vq_index_end) { + /* We're evaluating CVQ, that must always enable first */ + return true; + } + + if (!vhost_vdpa_net_valid_svq_features(v->dev->features, NULL) || + !cvq_s->cvq_isolated) { + /* CVQ is not isolated, so let's enable as usual */ + return true; + } + + return false; } static const VhostVDPAVirtIOOps vhost_vdpa_virtio_net_ops = { From patchwork Fri Jul 28 17:20:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332580 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D035C001DE for ; Fri, 28 Jul 2023 18:54:52 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR96-0001ao-Nm; Fri, 28 Jul 2023 13:20:56 -0400 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 1qPR95-0001ac-BM for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:55 -0400 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 1qPR94-0000Er-15 for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:55 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564853; 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=DLBGJawtkrYHfVbJApKuQXOsyi31D2kKEHtjvnCvcO8=; b=A5u/iCinbMr13vWK7FXnks1jbSVwQaDVBbJ153iHotHItK28U+EDPZmEvIbbw7QSEv9uK5 wFRJlJHi6IdS0mnwCD4Td5wCezfKZDGGCxgwlKau5d/l+3BI6oAnvjdRe/UnYzREQIOH9V rb7ma2aucBGCaBC4SI/cPV+GlHG8A/o= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-112-wjjaCNrdMzqMgyaW8Rbbuw-1; Fri, 28 Jul 2023 13:20:50 -0400 X-MC-Unique: wjjaCNrdMzqMgyaW8Rbbuw-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B00C78008A4; Fri, 28 Jul 2023 17:20:49 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7244C1121330; Fri, 28 Jul 2023 17:20:47 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 6/7] vdpa: enable cvq svq if data vq are shadowed Date: Fri, 28 Jul 2023 19:20:27 +0200 Message-Id: <20230728172028.2074052-7-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Previous to this commit, it was assumed that data can only be shadowed with x-cvq, or if a migration was in place. So CVQ did not need to check for migration. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 2c1cfda657..118837c6b9 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -514,11 +514,10 @@ static int vhost_vdpa_net_cvq_start(NetClientState *nc) s0 = vhost_vdpa_net_first_nc_vdpa(s); v->shadow_data = s0->vhost_vdpa.shadow_vqs_enabled; - v->shadow_vqs_enabled = s->always_svq; + v->shadow_vqs_enabled = v->shadow_data; s->vhost_vdpa.address_space_id = VHOST_VDPA_GUEST_PA_ASID; - if (s->vhost_vdpa.shadow_data) { - /* SVQ is already configured for all virtqueues */ + if (s->always_svq) { goto out; } From patchwork Fri Jul 28 17:20:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Eugenio Perez Martin X-Patchwork-Id: 13332575 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 80D22C001DE for ; Fri, 28 Jul 2023 18:41:36 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qPR9A-0001bR-DI; Fri, 28 Jul 2023 13:21:00 -0400 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 1qPR98-0001b4-A4 for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qPR97-0000MP-0L for qemu-devel@nongnu.org; Fri, 28 Jul 2023 13:20:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1690564856; 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=g/7pQzHfU65+0Q5ONhHthvSzKMuKtyj9JrntdEQCv4w=; b=YtPccQ+oxSYphSVgrU4856jORsk3LnWH4K40nx0gZvSroNOCVt4g9uWQ44E4fMQBgRx8T1 xQz9Sz+CrTJUZTRhd9uzZp+cxtdjvd0DADdKhPISo7WFwycjoYbP1IrHYN6VPAFINKsWWG T9NFF6zQ29RA8t1oc0++/InksRJ40eA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-283-t0kkvNi7PzOZpCZk5arIIg-1; Fri, 28 Jul 2023 13:20:52 -0400 X-MC-Unique: t0kkvNi7PzOZpCZk5arIIg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3331D856F67; Fri, 28 Jul 2023 17:20:52 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id F07F31121330; Fri, 28 Jul 2023 17:20:49 +0000 (UTC) From: =?utf-8?q?Eugenio_P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: Jason Wang , Gautam Dawar , si-wei.liu@oracle.com, Zhu Lingshan , Stefano Garzarella , Parav Pandit , Cindy Lu , "Michael S. Tsirkin" , Harpreet Singh Anand , Laurent Vivier , Shannon Nelson , Lei Yang , Dragos Tatulea Subject: [PATCH 7/7] vdpa: remove net cvq migration blocker Date: Fri, 28 Jul 2023 19:20:28 +0200 Message-Id: <20230728172028.2074052-8-eperezma@redhat.com> In-Reply-To: <20230728172028.2074052-1-eperezma@redhat.com> References: <20230728172028.2074052-1-eperezma@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 Received-SPF: pass client-ip=170.10.129.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_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Now that we have add migration blockers if the device does not support all the needed features, remove the general blocker applied to all net devices with CVQ. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 118837c6b9..cc3455d131 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -1443,18 +1443,6 @@ static NetClientState *net_vhost_vdpa_init(NetClientState *peer, s->vhost_vdpa.shadow_vq_ops = &vhost_vdpa_net_svq_ops; s->vhost_vdpa.shadow_vq_ops_opaque = s; s->cvq_isolated = cvq_isolated; - - /* - * TODO: We cannot migrate devices with CVQ and no x-svq enabled as - * there is no way to set the device state (MAC, MQ, etc) before - * starting the datapath. - * - * Migration blocker ownership now belongs to s->vhost_vdpa. - */ - if (!svq) { - error_setg(&s->vhost_vdpa.migration_blocker, - "net vdpa cannot migrate with CVQ feature"); - } } ret = vhost_vdpa_add(nc, (void *)&s->vhost_vdpa, queue_pair_index, nvqs); if (ret) {