From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689876946; cv=none; d=zohomail.com; s=zohoarc; b=gSKE2qaHDU5LR6YODcwGAX23ACtEyhZ0DMR+fnrtr8wBvzpmZ/K4/7NNZzpPCrV+9bPih4ogzwQ5k0TVYNs089fmb/spcNjffaCqRAOj3Avl43f5hEBwyJJoOvEcou/sO9jnV5mqOSAvHAjVxN9uBjZR6OnqNWw5JbNqnzeSEig= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689876946; 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=409EOOckyGprOXBiPYJE6nLyFod7nNzqMkRIEKlNrxM=; b=hcOyH4Nhln/oWZLzNc27oC8X/nGFMSXvk2F09tHtQxya+n4/NEXZFwgMbiTNhBG5MCimvRot4xLVLjd3dqejA2Tp9GOjVNUIXhj8nUiuyy/Sz5/6qJH8jJWHP+lwpzjPdsHUm39Wg63LL7NI9KiRfvnkoZYRe3U6gOnH+I+vcYs= 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+importer=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 1689876946561789.2373219991324; Thu, 20 Jul 2023 11:15:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBI-0004DH-14; Thu, 20 Jul 2023 14:15:16 -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 1qMYBE-0004CN-J2 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:12 -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 1qMYBD-0003Gn-4w for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:12 -0400 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-209-A191j2kRPru0XieQfzgcvw-1; Thu, 20 Jul 2023 14:15:05 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id DEC6088D1A0; Thu, 20 Jul 2023 18:15:04 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8E9D72166B25; Thu, 20 Jul 2023 18:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876907; 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=409EOOckyGprOXBiPYJE6nLyFod7nNzqMkRIEKlNrxM=; b=EsMw1hHaKQsYscE5NCpavDK6SINTvy3DBDXxCZOoSz6HSxXsgbj9ComEXUDNGCe8GGogVO O8XIUsmUHEo0SA7c3jgt/hV16qTjYwaLMWSSjB1qD/2wBshrgMW+gPtFDn92+YKNUOss/O kEgQv1vRnxMxJb480pPfbVMdJKhLHK8= X-MC-Unique: A191j2kRPru0XieQfzgcvw-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 01/12] vhost: add vhost_reset_queue_op Date: Thu, 20 Jul 2023 20:14:48 +0200 Message-Id: <20230720181459.607008-2-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689876948612100003 So different vhost backends can perform custom actions at queue reset. Signed-off-by: Eugenio P=C3=A9rez --- include/hw/virtio/vhost-backend.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index 31a251a9f5..37e05fa1f9 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -133,6 +133,8 @@ typedef int (*vhost_set_config_call_op)(struct vhost_de= v *dev, =20 typedef void (*vhost_reset_status_op)(struct vhost_dev *dev); =20 +typedef void (*vhost_reset_queue_op)(struct vhost_dev *dev, int idx); + typedef struct VhostOps { VhostBackendType backend_type; vhost_backend_init vhost_backend_init; @@ -181,6 +183,7 @@ typedef struct VhostOps { vhost_force_iommu_op vhost_force_iommu; vhost_set_config_call_op vhost_set_config_call; vhost_reset_status_op vhost_reset_status; + vhost_reset_queue_op vhost_reset_queue; } VhostOps; =20 int vhost_backend_update_device_iotlb(struct vhost_dev *dev, --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689877003; cv=none; d=zohomail.com; s=zohoarc; b=VpbX9xiEaaWRs3/5iYiH3co5689EpV+1uyc3/FlOBtSP90V99lLWBH0l+LK0GsKdR53QvsiotCITcjw+CcZcbESjlzLZ15IrT51x7Q7buqiUir1+N7oT8oW06DQ0zmQ8CZV29vvQZEw4szuH/64adD8VngpQX9gYQkhcHdIv9Po= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689877003; 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=Nag6baYm1KG8EZBPsQkKS/2lJrXvwaihqgRRI4ssZX8=; b=lKw3nZeZeF5SYaQ2YsH0JnYC7NORyjxvHL5e8AnpSPVPZTB6s3S6epvarW4et9D14WOrnlj7GitusihDwJn7RWdjIAm/BxqNHNDv0UV/xGQvtPtKDr2uXeyVGJxXU4b/ShrpGJiiEG/3bDaMjGmAsE7ILrVnCElfVJVOj2hQOrc= 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+importer=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 1689877003865952.9039809262872; Thu, 20 Jul 2023 11:16:43 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBd-0004L7-Hs; Thu, 20 Jul 2023 14:15:37 -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 1qMYBJ-0004Dm-QY for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:19 -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 1qMYBG-0003I3-O4 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:16 -0400 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-83-o2SLo1nhMSC3D4TIvPaW6g-1; Thu, 20 Jul 2023 14:15:07 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 79D851C04356; Thu, 20 Jul 2023 18:15:06 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28D012166B25; Thu, 20 Jul 2023 18:15:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876913; 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=Nag6baYm1KG8EZBPsQkKS/2lJrXvwaihqgRRI4ssZX8=; b=dhs0iUJbeqFqq/xqo/nOrHKxGPhatKk33+YPRrfQ4AhC6NbnQVuiSHKyEgNjdgPQCy9kvi 7Fdt0mqthXaXYAJXBeFQIrThwciimpF2x5po08kjZ09MhTBWMCwo9wwTYlJqMD/GBmo6AD ehNjp+N2B3mdy/Sq4tab/WfGsshO1HY= X-MC-Unique: o2SLo1nhMSC3D4TIvPaW6g-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 02/12] vhost: add vhost_restart_queue_op Date: Thu, 20 Jul 2023 20:14:49 +0200 Message-Id: <20230720181459.607008-3-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689877005282100003 So different vhost backends can perform custom actions at queue restart. Signed-off-by: Eugenio P=C3=A9rez --- include/hw/virtio/vhost-backend.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/hw/virtio/vhost-backend.h b/include/hw/virtio/vhost-ba= ckend.h index 37e05fa1f9..651402af10 100644 --- a/include/hw/virtio/vhost-backend.h +++ b/include/hw/virtio/vhost-backend.h @@ -135,6 +135,8 @@ typedef void (*vhost_reset_status_op)(struct vhost_dev = *dev); =20 typedef void (*vhost_reset_queue_op)(struct vhost_dev *dev, int idx); =20 +typedef int (*vhost_restart_queue_op)(struct vhost_dev *dev, int idx); + typedef struct VhostOps { VhostBackendType backend_type; vhost_backend_init vhost_backend_init; @@ -184,6 +186,7 @@ typedef struct VhostOps { vhost_set_config_call_op vhost_set_config_call; vhost_reset_status_op vhost_reset_status; vhost_reset_queue_op vhost_reset_queue; + vhost_restart_queue_op vhost_restart_queue; } VhostOps; =20 int vhost_backend_update_device_iotlb(struct vhost_dev *dev, --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689876931; cv=none; d=zohomail.com; s=zohoarc; b=fzTRmC1KraJtgPh5IKzoOah8+IBtLmBkHHk0V6FFITWqC95sj5t1nqYTonz40WLf3fJID3qtSWQgEayTf8Pl2cTEEx1eFqNc/UXUl6IfXfWzn3fE+z4SJa7uixdinHKtINSLgKXYpJC4cS5EFQULhSjk4myKTSLvfc+K8XtvAE4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689876931; 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=8f4eu9n15Kw63ow2RmMKDIC50OvvS8TO7HOPVAUm5P8=; b=Sgo5Vi9hZZKVHkloitBgsg21UQMJWGKLeCPD54rE0Rn73UTuV2/fge9BILc+/k0+c3lc7W+nlOuuIntePv7QRssiODSBRdwD1VBqQiT07HDVREAdUjnFY/nVbp8QVUhgwx4omOf7/jqnzIEyXMSoOv5zRExSeHBxMa9/y50y7JQ= 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+importer=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 1689876931390528.4102502998052; Thu, 20 Jul 2023 11:15:31 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBJ-0004DK-LT; Thu, 20 Jul 2023 14:15:18 -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 1qMYBG-0004CZ-MX for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:15 -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 1qMYBE-0003HJ-6r for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:13 -0400 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-189-G4igimKGNB6CjPl4WvApKA-1; Thu, 20 Jul 2023 14:15:08 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 147A32804601; Thu, 20 Jul 2023 18:15:08 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id B6FDA2166B25; Thu, 20 Jul 2023 18:15:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876910; 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=8f4eu9n15Kw63ow2RmMKDIC50OvvS8TO7HOPVAUm5P8=; b=P5Cw2Xn/NY4MEjCjbIamTtCdJUJEW1Kj0Zofb4VWwaYvo97fcksCxiJ/3f0j+hYt+WciOW xB3CgzvbB2fjNvtGcWEG6ZHOjwDZ3oT2UmkJtmZLwNwN0xwEuD8RHKl3WwaYiq3GAORXtg RhROBaEmBSizvZ/dlAT6OinY8+MrLc0= X-MC-Unique: G4igimKGNB6CjPl4WvApKA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 03/12] vhost_net: Use ops->vhost_restart_queue in vhost_net_virtqueue_restart Date: Thu, 20 Jul 2023 20:14:50 +0200 Message-Id: <20230720181459.607008-4-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689876932688100003 Actually use vhost_restart_queue operation at restart. Signed-off-by: Eugenio P=C3=A9rez --- hw/net/vhost_net.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 6b958d6363..416b7d8132 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -608,14 +608,16 @@ int vhost_net_virtqueue_restart(VirtIODevice *vdev, N= etClientState *nc, goto err_start; } =20 - if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { + if (vhost_ops->vhost_restart_queue) { + r =3D vhost_ops->vhost_restart_queue(&net->dev, idx); + } else if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { file.index =3D idx; file.fd =3D net->backend; r =3D vhost_net_set_backend(&net->dev, &file); - if (r < 0) { - r =3D -errno; - goto err_start; - } + } + if (r < 0) { + r =3D -errno; + goto err_start; } =20 return 0; --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689876942; cv=none; d=zohomail.com; s=zohoarc; b=fYY7ZXlOsF6a2XduoTassir+7iZTjkbcH2PvUg/QwfyWNTHaDhL3HHDw/n0MIfluQC+UjD84N68AYez2XyExy9rMWghCzQ3kFoOy1n03xm/Dp+aD7FCUgYLVBoCD6koeOP7/4RtrKcP6/dGoXoUMHTCbLrx6exYFlwkNixm+xU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689876942; 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=eu4qTpdtrX2d/XYLxdli0lOHKKZpEE/V8SV9u/E5FGY=; b=Tc/jr2P+C78PtcAGQqMnvCO/afIfTwipLzjTKVRCyyqi185fU0rUjWfw3lDTnjVWEFCE1wlwGeeR4X9YoDm/ww8djiUXzCtEExcD0CXJLfZ5EM7zcH+fUQFTVJ7qHiu2OCA+fSR45PIjDhkRnphuGjCH1xG9wvrAVeRCmuCJ/Mw= 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+importer=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 168987694238857.94634911007529; Thu, 20 Jul 2023 11:15:42 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBe-0004gE-M1; Thu, 20 Jul 2023 14:15:38 -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 1qMYBJ-0004Dl-QV for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:19 -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 1qMYBH-0003JV-2z for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:17 -0400 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-46-p-byukaQP0-7Ei2lchxz0w-1; Thu, 20 Jul 2023 14:15:10 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A35833C01DFA; Thu, 20 Jul 2023 18:15:09 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52A252166B25; Thu, 20 Jul 2023 18:15:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876914; 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=eu4qTpdtrX2d/XYLxdli0lOHKKZpEE/V8SV9u/E5FGY=; b=Sa3GCj/NHyltQXVg8ieX62RiL34tlQwL8/R6CSLJMZDRkU7Rr2axQOIbcA6Ou54pRwGsx2 M2w1z5M6NwUiUXKuRhRPSLdpssGsZo3ym/LGMKsuDas5tuOddRAPmV4mXQ/iWS7NqcVf4d DQyhtumC+l3/OBrAnfxZqMxUzi/mAI8= X-MC-Unique: p-byukaQP0-7Ei2lchxz0w-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 04/12] vhost_net: Use ops->vhost_reset_queue in vhost_net_virtqueue_reset Date: Thu, 20 Jul 2023 20:14:51 +0200 Message-Id: <20230720181459.607008-5-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=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_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689876944584100003 Actually use vhost_reset_queue operation at queue reset. Signed-off-by: Eugenio P=C3=A9rez --- hw/net/vhost_net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 416b7d8132..5516b7a5aa 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -571,7 +571,9 @@ void vhost_net_virtqueue_reset(VirtIODevice *vdev, NetC= lientState *nc, =20 idx =3D vhost_ops->vhost_get_vq_index(&net->dev, vq_index); =20 - if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { + if (vhost_ops->vhost_reset_queue) { + vhost_ops->vhost_reset_queue(&net->dev, idx); + } else if (net->nc->info->type =3D=3D NET_CLIENT_DRIVER_TAP) { file.index =3D idx; int r =3D vhost_net_set_backend(&net->dev, &file); assert(r >=3D 0); --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689876990; cv=none; d=zohomail.com; s=zohoarc; b=RixbkaaemXnwnlq74g1MfQULy72afTvIdb/s74yOOwdrk83bDhK24Qq5CMCEoAwhZQ3MmBn/1q86RbTM46ZFu/+wWIk9i2m9nOSWU8xuo7MVzQT5+bBzdjkTgnVi0m08eDMf4MRil/da2XvH7F6lwpWhrzD9D1WLw/jDiVIf1Ew= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689876990; 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=PYBd5yDnfH/T6/KePGzF5vmEZfP6eou01c1gPkfVF3Q=; b=S1vjv4qiitRGqXrL6RQXNzE5VQAU9RptpC3vdk+2wlnlNwBErouLONOsQPWgTHmNo7onsQ2brVPW9ysjKB9lxiBzfOkBVgIylwp4sLcEvHbATBPxKB0ocpbF3CcJMkwJIOoWkFK6bVo4x1oSQudx0zmVjJJBQU4MXlFDf5Wq5bA= 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+importer=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 1689876990564110.6157637416211; Thu, 20 Jul 2023 11:16:30 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBR-0004Ed-SU; Thu, 20 Jul 2023 14:15:36 -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 1qMYBI-0004DJ-5k for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:17 -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 1qMYBG-0003I1-D6 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:15 -0400 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-369-dpdhQeiUPC6mx4dH7L738g-1; Thu, 20 Jul 2023 14:15:11 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3D39B8F1840; Thu, 20 Jul 2023 18:15:11 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id E133C2166B26; Thu, 20 Jul 2023 18:15:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876913; 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=PYBd5yDnfH/T6/KePGzF5vmEZfP6eou01c1gPkfVF3Q=; b=ZXeCD2r906BTMntaNtu/sNwv4LUhFIykdQVJFZ7NmnMlbPu+IiMggS5Em1jbynTzvwNNhJ c3MjCJoB8tOmgXbMyR0PzuKQwTzkVUh1YP0B9Nf4YQghxbtFDVmGJrvwnezAkViH7euL0R uXaZKeBmIW4QnKM5P92JhGtnpS0/h74= X-MC-Unique: dpdhQeiUPC6mx4dH7L738g-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 05/12] vdpa: add vhost_vdpa_set_vring_ready_internal Date: Thu, 20 Jul 2023 20:14:52 +0200 Message-Id: <20230720181459.607008-6-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689876991275100001 Reset a virtqueue reuses this call with .num =3D 0, so let's make it possible to use that way. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-vdpa.c | 12 +++++++++--- hw/virtio/trace-events | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index f51f5d9969..e7ab69165c 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -528,19 +528,25 @@ int vhost_vdpa_get_iova_range(int fd, struct vhost_vd= pa_iova_range *iova_range) return ret < 0 ? -errno : 0; } =20 -int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, unsigned idx) +static int vhost_vdpa_set_vring_ready_internal(struct vhost_vdpa *v, + unsigned idx, bool enable) { struct vhost_dev *dev =3D v->dev; struct vhost_vring_state state =3D { .index =3D idx, - .num =3D 1, + .num =3D enable, }; int r =3D vhost_vdpa_call(dev, VHOST_VDPA_SET_VRING_ENABLE, &state); =20 - trace_vhost_vdpa_set_vring_ready(dev, idx, r); + trace_vhost_vdpa_set_vring_ready(dev, idx, enable, r); return r; } =20 +int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, unsigned idx) +{ + return vhost_vdpa_set_vring_ready_internal(v, idx, true); +} + /* * The use of this function is for requests that only need to be * applied once. Typically such request occurs at the beginning diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events index 4f6a6ba428..9b90da73af 100644 --- a/hw/virtio/trace-events +++ b/hw/virtio/trace-events @@ -46,7 +46,7 @@ vhost_vdpa_set_features(void *dev, uint64_t features) "de= v: %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, uint8_t status) "dev: %p status: 0x%"PR= Ix8 vhost_vdpa_get_vq_index(void *dev, int idx, int vq_idx) "dev: %p idx: %d v= q idx: %d" -vhost_vdpa_set_vring_ready(void *dev, unsigned i, int r) "dev: %p, idx: %u= , r: %d" +vhost_vdpa_set_vring_ready(void *dev, unsigned i, bool e, int r) "dev: %p,= idx: %u, num: %d, 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 --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689876968; cv=none; d=zohomail.com; s=zohoarc; b=Ej+/wDuU0UZGD7dUN98XhVdlZEFdrjdCKCDrVkFUCQYYaKhWf62BVCJldQTUo2F6SeKsJu0twz514rpL4/u1kdTlMvMNeyCFxKljXphNj8/cRsD5MfZ4bSHNcCB5l5QQ5ABeQaJLMVX3pyyQ3OtfYCElw90mm7/Fm/+z/g5GRYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689876968; 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=qg88jCdQgB4EKRvwYnaU1oPtFH+EzvWegO2XUblXAbg=; b=B49sQTcqqBWzqt5wLOBwFirXN5kSPf9DO4tuGe8sulc7mU+4h+euBcErd/AqsOdnGD4/c3owoCn5qIWfR0c3PMSrZ46Qz030+8PDAaBkNSqHjaMuma0QGkq3Zw0aTwqrjnZtQStgc10+b9mwujNuGfCm2KqAzloTPx0b1xplUXs= 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+importer=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 1689876968350960.0665116001304; Thu, 20 Jul 2023 11:16:08 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBe-0004ge-MS; Thu, 20 Jul 2023 14:15:38 -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 1qMYBL-0004Ea-N4 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:21 -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 1qMYBK-0003KT-AA for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:19 -0400 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-543-xQZg8CVsMICA-mX4k1V5pQ-1; Thu, 20 Jul 2023 14:15:14 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id C9AE6858EED; Thu, 20 Jul 2023 18:15:12 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 79ECE2166B26; Thu, 20 Jul 2023 18:15:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876917; 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=qg88jCdQgB4EKRvwYnaU1oPtFH+EzvWegO2XUblXAbg=; b=Fu7XIyI80xWgoAC8p6hh2+IxORpS7R84hfrSUNcGT+VCfDpCYSwrX/vwY+DTFB3y1u95w5 5C1TDSLI1jaBBvDE7R660RfDjV84KuJjI5WuP2zpB0FV/WLIkOaxrBkKpf+PYYpJrxOU2d BcZBvG/4zCHVeB/xmEBP4RT5hL88q9M= X-MC-Unique: xQZg8CVsMICA-mX4k1V5pQ-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 06/12] vdpa: add vhost_vdpa_svq_stop Date: Thu, 20 Jul 2023 20:14:53 +0200 Message-Id: <20230720181459.607008-7-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689876968948100001 To split each SVQ stop in its own stop routine let's us to reset a VQ individually, and to keep future vhost_vdpa_reset_queue symmetrical with vhost_vdpa_reset_queue. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-vdpa.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index e7ab69165c..6ae276ccde 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1263,6 +1263,18 @@ err: return false; } =20 +static void vhost_vdpa_svq_stop(struct vhost_dev *dev, unsigned idx) +{ + struct vhost_vdpa *v =3D dev->opaque; + VhostShadowVirtqueue *svq =3D g_ptr_array_index(v->shadow_vqs, idx); + + vhost_svq_stop(svq); + vhost_vdpa_svq_unmap_rings(dev, svq); + + event_notifier_cleanup(&svq->hdev_kick); + event_notifier_cleanup(&svq->hdev_call); +} + static void vhost_vdpa_svqs_stop(struct vhost_dev *dev) { struct vhost_vdpa *v =3D dev->opaque; @@ -1272,13 +1284,7 @@ static void vhost_vdpa_svqs_stop(struct vhost_dev *d= ev) } =20 for (unsigned i =3D 0; i < v->shadow_vqs->len; ++i) { - VhostShadowVirtqueue *svq =3D g_ptr_array_index(v->shadow_vqs, i); - - vhost_svq_stop(svq); - vhost_vdpa_svq_unmap_rings(dev, svq); - - event_notifier_cleanup(&svq->hdev_kick); - event_notifier_cleanup(&svq->hdev_call); + vhost_vdpa_svq_stop(dev, i); } } =20 --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689877007; cv=none; d=zohomail.com; s=zohoarc; b=lRDJZ1BZbl0hNC2k8rFd01TZRV0y3zoSw1esERT8o8HBRNr1aVaOzkFAeV2VU0LR2T3Srfi4sWhb2ljVqhXrpDwWwXCN4L8yaroU0sKEuE3E0E4OkoUqCtOeHkmW+jienI58ynkBVyq6FpLlWXNlu0PXbvG7ArlaCE8yV1xVxMI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689877007; 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=5QotPEGjo10DbOO0YXVh4lwgMOojeZ5NQ9zmNRsLIvE=; b=Np5SKW8A+aVJOmscRC/xfGm+C/foPHiKcMeoWeHRdVF4WxqMx7ogfN+XA7cog+SMwRtYDhMDzhS0hL4uLwXKcytcTRYP70gSx00AvllqsnXQ/ofMv01Bf+SYfuMDZ71U8yKHxUioKs2QHeou5J4ChJ1eXnGM+ZYs3m3uCteS8Xw= 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+importer=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 1689877007454660.7106604790507; Thu, 20 Jul 2023 11:16:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBg-0004pY-OL; Thu, 20 Jul 2023 14:15:42 -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 1qMYBQ-0004Kv-Pt for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:36 -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 1qMYBL-0003Kx-4z for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:23 -0400 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-139-6bYFrr7ePyesrB6GhOo3ww-1; Thu, 20 Jul 2023 14:15:15 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63C0A800C7F; Thu, 20 Jul 2023 18:15:14 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1285A2166B25; Thu, 20 Jul 2023 18:15:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876918; 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=5QotPEGjo10DbOO0YXVh4lwgMOojeZ5NQ9zmNRsLIvE=; b=IIEKU0Mw9q1sRfyRLebyl+RZNpNKUiVaFbUkLgbefs4V4L7NiY2F4oaFllTVs7j76XUlDt WXz6UPPaWxSP6QIHq/l9JIv0d28+eidwz8pXn3V9QZ1Moysd67obONSE0ovIoGzk5ieyQ7 kvBzlsmJWCPyHRwQmzVC6u4wk9pTBkQ= X-MC-Unique: 6bYFrr7ePyesrB6GhOo3ww-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 07/12] vdpa: add vhost_vdpa_reset_queue Date: Thu, 20 Jul 2023 20:14:54 +0200 Message-Id: <20230720181459.607008-8-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689877009227100017 Split out vq reset operation in its own function, as it may be called with ring reset. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-vdpa.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 6ae276ccde..df2515a247 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -547,6 +547,21 @@ int vhost_vdpa_set_vring_ready(struct vhost_vdpa *v, u= nsigned idx) return vhost_vdpa_set_vring_ready_internal(v, idx, true); } =20 +/* TODO: Properly reorder static functions */ +static void vhost_vdpa_svq_stop(struct vhost_dev *dev, unsigned idx); +static void vhost_vdpa_reset_queue(struct vhost_dev *dev, int idx) +{ + struct vhost_vdpa *v =3D dev->opaque; + + if (dev->features & VIRTIO_F_RING_RESET) { + vhost_vdpa_set_vring_ready_internal(v, idx, false); + } + + if (v->shadow_vqs_enabled) { + vhost_vdpa_svq_stop(dev, idx - dev->vq_index); + } +} + /* * The use of this function is for requests that only need to be * applied once. Typically such request occurs at the beginning @@ -1543,4 +1558,5 @@ const VhostOps vdpa_ops =3D { .vhost_force_iommu =3D vhost_vdpa_force_iommu, .vhost_set_config_call =3D vhost_vdpa_set_config_call, .vhost_reset_status =3D vhost_vdpa_reset_status, + .vhost_reset_queue =3D vhost_vdpa_reset_queue, }; --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689877005; cv=none; d=zohomail.com; s=zohoarc; b=biyuWNEArLzOryHsHGgpVAoBeoj89MZMPBGczgph4FlH+eoiuqSYWGwNc8uyWNKEsfKhxhPtwdw9Ffa5AMh5D70nxZmBjaOwk6WQFsv7E8uCF70v1fbWq31aaE0deoGm+eNVe8TkLZLVbjLJmJWyK+RzWBFg4RvqmGovTKeQDsw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689877005; 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=ojGrOHq8nhRb5TNbtbaXmRffqo/08cKoEX9WwfmfcUE=; b=OUZaSYid2kXnwEiYKvX55lYw1F711AH5Dm0VdAfAgd/YmmorEqUbkm7tDXCOpyWq/txpIPb1Vr1UwmSk/K2CKTlVrOu3qMWkC+O0owDWk7+FSyk8ho9+4TzYFJGxVLER9Trx23HBPEpOIb7gPc4rDVAKAf+fSsN8urvaLWUoP3E= 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+importer=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 1689877005850829.4005850102319; Thu, 20 Jul 2023 11:16:45 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBg-0004pV-OP; Thu, 20 Jul 2023 14:15:42 -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 1qMYBN-0004F2-SE for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:22 -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 1qMYBM-0003LK-E2 for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:21 -0400 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-615-9ICOeEUwMuqzd8UeYcsh0Q-1; Thu, 20 Jul 2023 14:15:16 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F19EC800C7F; Thu, 20 Jul 2023 18:15:15 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id A081E2166B26; Thu, 20 Jul 2023 18:15:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876919; 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=ojGrOHq8nhRb5TNbtbaXmRffqo/08cKoEX9WwfmfcUE=; b=LwxFFWI/gPstGvbyClDPgreBl3s+XWIwXBRatvtwSH/N3IwtjFIFCRSxv7vqvTm5rHchcx J5Z5BhMr1LxZ5IKa2EhAb2gNZ4OvfGzFbcClPvT3aOWoJayg4PUHQ3yGHHNAlD3RYp4C3H 7lsLM3Bsf1573+Ze/TSO9l/BCnLy9GQ= X-MC-Unique: 9ICOeEUwMuqzd8UeYcsh0Q-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 08/12] vdpa: add vhost_vdpa_svq_start Date: Thu, 20 Jul 2023 20:14:55 +0200 Message-Id: <20230720181459.607008-9-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689877007316100007 To split each SVQ in its own initialization routine let's us to restart a VQ individually, and to keep future vhost_vdpa_restart_queue symmetrical with vhost_vdpa_reset_queue. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-vdpa.c | 67 ++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 26 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index df2515a247..7248072989 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1223,6 +1223,46 @@ static bool vhost_vdpa_svq_setup(struct vhost_dev *d= ev, return r =3D=3D 0; } =20 +static bool vhost_vdpa_svq_start(struct vhost_dev *dev, unsigned i, + Error **errp) +{ + struct vhost_vdpa *v =3D dev->opaque; + VirtQueue *vq =3D virtio_get_queue(dev->vdev, dev->vq_index + i); + VhostShadowVirtqueue *svq =3D g_ptr_array_index(v->shadow_vqs, i); + struct vhost_vring_addr addr =3D { + .index =3D dev->vq_index + i, + }; + int r; + bool ok =3D vhost_vdpa_svq_setup(dev, svq, i, errp); + if (unlikely(!ok)) { + goto err; + } + + vhost_svq_start(svq, dev->vdev, vq, v->iova_tree); + ok =3D vhost_vdpa_svq_map_rings(dev, svq, &addr, errp); + if (unlikely(!ok)) { + goto err_map; + } + + /* Override vring GPA set by vhost subsystem */ + r =3D vhost_vdpa_set_vring_dev_addr(dev, &addr); + if (unlikely(r !=3D 0)) { + error_setg_errno(errp, -r, "Cannot set device address"); + goto err_set_addr; + } + + return true; + +err_set_addr: + vhost_vdpa_svq_unmap_rings(dev, g_ptr_array_index(v->shadow_vqs, i)); + +err_map: + vhost_svq_stop(g_ptr_array_index(v->shadow_vqs, i)); + +err: + return false; +} + static bool vhost_vdpa_svqs_start(struct vhost_dev *dev) { struct vhost_vdpa *v =3D dev->opaque; @@ -1234,39 +1274,14 @@ static bool vhost_vdpa_svqs_start(struct vhost_dev = *dev) } =20 for (i =3D 0; i < v->shadow_vqs->len; ++i) { - VirtQueue *vq =3D virtio_get_queue(dev->vdev, dev->vq_index + i); - VhostShadowVirtqueue *svq =3D g_ptr_array_index(v->shadow_vqs, i); - struct vhost_vring_addr addr =3D { - .index =3D dev->vq_index + i, - }; - int r; - bool ok =3D vhost_vdpa_svq_setup(dev, svq, i, &err); + bool ok =3D vhost_vdpa_svq_start(dev, i, &err); if (unlikely(!ok)) { goto err; } - - vhost_svq_start(svq, dev->vdev, vq, v->iova_tree); - ok =3D vhost_vdpa_svq_map_rings(dev, svq, &addr, &err); - if (unlikely(!ok)) { - goto err_map; - } - - /* Override vring GPA set by vhost subsystem */ - r =3D vhost_vdpa_set_vring_dev_addr(dev, &addr); - if (unlikely(r !=3D 0)) { - error_setg_errno(&err, -r, "Cannot set device address"); - goto err_set_addr; - } } =20 return true; =20 -err_set_addr: - vhost_vdpa_svq_unmap_rings(dev, g_ptr_array_index(v->shadow_vqs, i)); - -err_map: - vhost_svq_stop(g_ptr_array_index(v->shadow_vqs, i)); - err: error_reportf_err(err, "Cannot setup SVQ %u: ", i); for (unsigned j =3D 0; j < i; ++j) { --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689876953; cv=none; d=zohomail.com; s=zohoarc; b=aJnce9eGMN64sqQnV66zlaIo8bMMdwLe0a7PpFwhDizClzyhKth/ic58ldcaakxG9wo9iEC7r21411W5gXMu+HIzNb8hHwkkScy51HAuUiYh2CyDghsbsQMUUqe6wtMRSdDvlyD/vx2rbSAVh6mCO1JxlNe0tFwaK+ej4QUzIjA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689876953; 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=+ytfb3HXV+wFwSIUmTNAnsUHTHuXBYfLCvZ0GHbLF5w=; b=Sxy3GBE8bckQfouGCOk2AWY/Prhd1qkOIsFknE5ypp/RiAegasetNBSrM/O1zpr/uzbYMxTL+y/rxf5lROkrK0eOn6MfiSDJydWzSoIn7l+eM8JrmeUTiQVigXDYl0DmP9gAiZDefGYWCY3b3XHVt9Ib+MsrDQ+fin7fDC0U8Qg= 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+importer=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 1689876953178577.1691665481757; Thu, 20 Jul 2023 11:15:53 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBk-00059Q-TX; Thu, 20 Jul 2023 14:15:45 -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 1qMYBR-0004L8-UT for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:36 -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 1qMYBQ-0003Lx-JC for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:25 -0400 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-372-di8aBrTNMa6DgL5B80uODA-1; Thu, 20 Jul 2023 14:15:18 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 8CFAC88D196; Thu, 20 Jul 2023 18:15:17 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3A7222166B25; Thu, 20 Jul 2023 18:15:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876923; 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=+ytfb3HXV+wFwSIUmTNAnsUHTHuXBYfLCvZ0GHbLF5w=; b=ijUGZ9Pc19Q8ABUrYNU8psEVXzZzCJI7ZvSdO1AgtBZ1VpIoxiptJb14x2/waq4NazacCB MDPmrojVfJLSC2i2ALiW9kpyBgGrtlQdmXhoZFTckl6ytzxEjgeNfWwuZaE+Ofjx1DGdE+ warKu/aCorz4gJRKepCgBi7aG0Zgmy8= X-MC-Unique: di8aBrTNMa6DgL5B80uODA-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 09/12] vdpa: add vhost_vdpa_restart_queue Date: Thu, 20 Jul 2023 20:14:56 +0200 Message-Id: <20230720181459.607008-10-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=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_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689876954858100003 Split out vq restart operation in its own function, as it may be called with ring reset. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-vdpa.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 7248072989..7b24fa3e12 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -562,6 +562,29 @@ static void vhost_vdpa_reset_queue(struct vhost_dev *d= ev, int idx) } } =20 +/* TODO: Properly reorder static functions */ +static bool vhost_vdpa_svq_start(struct vhost_dev *dev, unsigned i, + Error **errp); +static int vhost_vdpa_restart_queue(struct vhost_dev *dev, int idx) +{ + struct vhost_vdpa *v =3D dev->opaque; + + if (v->shadow_vqs_enabled) { + Error *err =3D NULL; + bool ok =3D vhost_vdpa_svq_start(dev, idx, &err); + if (unlikely(!ok)) { + error_report_err(err); + return -1; + } + } + + if (dev->features & VIRTIO_F_RING_RESET) { + return vhost_vdpa_set_vring_ready_internal(v, idx, true); + } + + return 0; +} + /* * The use of this function is for requests that only need to be * applied once. Typically such request occurs at the beginning @@ -1574,4 +1597,5 @@ const VhostOps vdpa_ops =3D { .vhost_set_config_call =3D vhost_vdpa_set_config_call, .vhost_reset_status =3D vhost_vdpa_reset_status, .vhost_reset_queue =3D vhost_vdpa_reset_queue, + .vhost_restart_queue =3D vhost_vdpa_restart_queue, }; --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689877016; cv=none; d=zohomail.com; s=zohoarc; b=Kyqswdtl0A+QEQjf7t0TE8VcOehugkQ1KzmuBkdmhEvNqmmUTb6tb/O5VfTmN+Iwz0fGp0T5AYp5tc+oanSvuo/8UBTf+fUPOV0FronWOI0YBIPadKu/Zsp9x8DG/C8SBvC1TkuCGhlFMQ+AWOZVllF8PYENNOVYP+Y1B35KwaI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689877016; 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=P9CKyKCD2Asr59YwlxOKNQ11bPRWkSiQVn9Bq1tQZj4=; b=kqTQBGXHJlcr/OYJy1jaE/klNmFls3QeVuyGvq7kNMIHTapq+TpfvdR0lqLr8SgHLXtTbqnrdcROESgVe8V6tPKggolEPX2dR2pKTRdY8eFOFr3haxlM6Xqg3KxCsG/I5YjzCj5YtBQYdHbpy357QmYXuvtZkDmEoDRnRqbyRSM= 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+importer=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 1689877016418616.7685511995962; Thu, 20 Jul 2023 11:16:56 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBl-0005I6-Lf; Thu, 20 Jul 2023 14:15: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 1qMYBR-0004Kw-AC for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:36 -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 1qMYBP-0003Lr-Nu for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:24 -0400 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-414-qCsMew6hOeqEtO4NXk0sKQ-1; Thu, 20 Jul 2023 14:15:19 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 3032F3C01DF3; Thu, 20 Jul 2023 18:15:19 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id CABA32166B25; Thu, 20 Jul 2023 18:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876923; 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=P9CKyKCD2Asr59YwlxOKNQ11bPRWkSiQVn9Bq1tQZj4=; b=KLn7TfdEvq6fy0GnsWdkHZD2msllcmqxdmQ6GClw8AW9fmLfTobEYM/dyOhnXWKWzb6f5w bxUsRL0AfjVrG+9b8lZZlW4rcEwGeak8VtgvFYQfXyM0EqTYavwrQDr79uoM78bUIf+lY0 PftdPFjZymcvZw6oq0ihLumJBZSFTeM= X-MC-Unique: qCsMew6hOeqEtO4NXk0sKQ-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 10/12] vdpa: enable all vqs if the device support RING_RESET feature Date: Thu, 20 Jul 2023 20:14:57 +0200 Message-Id: <20230720181459.607008-11-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=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_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689877017377100001 Prefer the ring reset approach against the late enable, as it is more aligned with the standard. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index 52415d7e0c..af83de92f8 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -840,8 +840,14 @@ static const VhostShadowVirtqueueOps vhost_vdpa_net_sv= q_ops =3D { */ static bool vhost_vdpa_should_enable(const struct vhost_vdpa *v) { + VhostVDPAState *s =3D container_of(v, VhostVDPAState, vhost_vdpa); struct vhost_dev *dev =3D v->dev; =20 + if (dev->features & VIRTIO_F_RING_RESET && !s->always_svq) { + /* Preventing dataplane processing exposing fake SVQ vring */ + return true; + } + if (!dev->vq_index_end % 2) { /* vDPA device does not have CVQ */ return true; --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689877007; cv=none; d=zohomail.com; s=zohoarc; b=X/cKt0hpQLfj8STq/O2n+EkJkL44tC0kd8OuKCK17mLSEwTgeAmpXsr/8/VQMAysV7Nh1rSj/4p5PmMVH0LD8Z4ynzapn/+mwVaJJIMtN/yNO/V6obGk+vnidz7tsrw3TLlL/3lsCWc55wTOwZ6Lh2LjDqdd5p3/KWvwSsonWvI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689877007; 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=6AnXRkfbPBY2lKGkgKhB/5jrIYEC5iVGXI+KaHqNwxg=; b=Z4KJZG9dVlsc/5LqCvMuNeSQHE9w2I/NuHtfL4yOm6/tT9IM+jn/rFYGnpjjU+T8WMib8aCJYjey05DxmP06vAdieU4hRoWRF3rN35lB/6JIs7+EglMknQcXZc0IPdrtkNQS+OA1dQzY7CzVya46JvQEPCX3PiwNAApyFzjt1oo= 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+importer=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 1689877007411700.1175480670013; Thu, 20 Jul 2023 11:16:47 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBk-00057w-3l; Thu, 20 Jul 2023 14:15:44 -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 1qMYBX-0004N6-Np for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:36 -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 1qMYBU-0003Mi-9t for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:30 -0400 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-433-HN_1A3gbP9Ok9goyrbYUbQ-1; Thu, 20 Jul 2023 14:15:21 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id BF80E38025EA; Thu, 20 Jul 2023 18:15:20 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6E3B32166B25; Thu, 20 Jul 2023 18:15:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876927; 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=6AnXRkfbPBY2lKGkgKhB/5jrIYEC5iVGXI+KaHqNwxg=; b=MhbzljXydb+rrAXm9U3hOvXibuYddf1KfW/R4bhWc+29+4oYV3I9MKlI+PDi42oTVocWxN +6KoWU9wqsJr394Ah9peIDGoFWs0+if997n+llzWIyHp7ufNIlJKbhdn5Qy1VjZCI91alW ZZI4CbF7anyEk2IpC6meO1Gpz0tZU0s= X-MC-Unique: HN_1A3gbP9Ok9goyrbYUbQ-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 11/12] vdpa: use SVQ to stall dataplane while NIC state is being restored Date: Thu, 20 Jul 2023 20:14:58 +0200 Message-Id: <20230720181459.607008-12-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=patchew.org@nongnu.org; helo=lists.gnu.org; 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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689877009348100019 Some dynamic state of a virtio-net vDPA devices is restored from CVQ in the event of a live migration. However, dataplane needs to be disabled so the NIC does not receive buffers in the invalid ring. As a default method to achieve it, let's offer a shadow vring with 0 avail idx. As a fallback method, we will enable dataplane vqs later, as proposed previously. Signed-off-by: Eugenio P=C3=A9rez --- net/vhost-vdpa.c | 49 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/net/vhost-vdpa.c b/net/vhost-vdpa.c index af83de92f8..e14ae48f23 100644 --- a/net/vhost-vdpa.c +++ b/net/vhost-vdpa.c @@ -338,10 +338,25 @@ static int vhost_vdpa_net_data_start(NetClientState *= nc) { VhostVDPAState *s =3D DO_UPCAST(VhostVDPAState, nc, nc); struct vhost_vdpa *v =3D &s->vhost_vdpa; + bool has_cvq =3D v->dev->vq_index_end % 2; =20 assert(nc->info->type =3D=3D NET_CLIENT_DRIVER_VHOST_VDPA); =20 - if (s->always_svq || + if (has_cvq && (v->dev->features & VIRTIO_F_RING_RESET)) { + /* + * Offer a fake vring to the device while the state is restored + * through CVQ. That way, the guest will not see packets in unexp= ected + * queues. + * + * This will be undone after loading all state through CVQ, at + * vhost_vdpa_net_load. + * + * TODO: Future optimizations may skip some SVQ setup and teardown, + * like set the right kick and call fd or doorbell maps directly, = and + * the iova tree. + */ + v->shadow_vqs_enabled =3D true; + } else if (s->always_svq || migration_is_setup_or_active(migrate_get_current()->state)) { v->shadow_vqs_enabled =3D true; v->shadow_data =3D true; @@ -738,10 +753,34 @@ static int vhost_vdpa_net_load(NetClientState *nc) return r; } =20 - for (int i =3D 0; i < v->dev->vq_index; ++i) { - r =3D vhost_vdpa_set_vring_ready(v, i); - if (unlikely(r)) { - return r; + if (v->dev->features & VIRTIO_F_RING_RESET && !s->always_svq && + !migration_is_setup_or_active(migrate_get_current()->state)) { + NICState *nic =3D qemu_get_nic(s->nc.peer); + int queue_pairs =3D n->multiqueue ? n->max_queue_pairs : 1; + + for (int i =3D 0; i < queue_pairs; ++i) { + NetClientState *ncs =3D qemu_get_peer(nic->ncs, i); + VhostVDPAState *s_i =3D DO_UPCAST(VhostVDPAState, nc, ncs); + + for (int j =3D 0; j < 2; ++j) { + vhost_net_virtqueue_reset(v->dev->vdev, ncs->peer, j); + } + + s_i->vhost_vdpa.shadow_vqs_enabled =3D false; + + for (int j =3D 0; j < 2; ++j) { + r =3D vhost_net_virtqueue_restart(v->dev->vdev, ncs->peer,= j); + if (unlikely(r < 0)) { + return r; + } + } + } + } else { + for (int i =3D 0; i < v->dev->vq_index; ++i) { + r =3D vhost_vdpa_set_vring_ready(v, i); + if (unlikely(r)) { + return r; + } } } =20 --=20 2.39.3 From nobody Fri May 17 03:54:26 2024 Delivered-To: importer@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+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1689877006; cv=none; d=zohomail.com; s=zohoarc; b=B/wieZljhxpanYQNW3zkCum9Kr8okniS5ZXBJrGYvM/cbiGD19H7ukQLbsVTSrduQRB4E6X+3wt14cbPM5lLf1z2Kl90NqfO1674cSriz459w1kd+TgJfVJJr6L7XvfOnMRoYPyqjsleJlMemqYlGZaO2Y4w/OCcYbR5iQMoGgg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1689877006; 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=2ZUd9jk4L3cGs5oDAJws5vHCA57czpNMxR7zblhwXCk=; b=McS2G2C12z3qwQ85E0C6Jd503c/ubaDXYmNIJuOZ8sUYl/7PIqF+rbin2vLfgqT9NWdMUQjQtzga+7T/k/3+JyiFIVth8yv3EEPzCU/z9AUHa8VUbEpu14RAMqdQNjqFJSM4Lv6UvHJ8vW/KdUou37JVHyDl7Q0i7ewcNkh110g= 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+importer=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 1689877006731866.3354885984884; Thu, 20 Jul 2023 11:16:46 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qMYBn-0005L5-QD; Thu, 20 Jul 2023 14:15: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 1qMYBV-0004LH-Pj for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:36 -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 1qMYBU-0003Mb-3D for qemu-devel@nongnu.org; Thu, 20 Jul 2023 14:15:29 -0400 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-516-ujPCZzHOOM2gHf2jsyAoRw-1; Thu, 20 Jul 2023 14:15:22 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 58CE485A58A; Thu, 20 Jul 2023 18:15:22 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 07B922166B25; Thu, 20 Jul 2023 18:15:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1689876927; 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=2ZUd9jk4L3cGs5oDAJws5vHCA57czpNMxR7zblhwXCk=; b=MaS5nMdY7edCSiMnq31eg1so2uyDxzQc+JnREWhmmzXnEaLBBlGRuRW6zrP570uJ+v6MRa TrEXFzfQIlcebLzSmOXE6HIqb3BZLe98aewfI07DQan8DItyOCjDzJC1wjDQb2spQ+HnZE mfF45IVya7VjfVucYB6Mh7SS96uJ4TQ= X-MC-Unique: ujPCZzHOOM2gHf2jsyAoRw-1 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: qemu-devel@nongnu.org Cc: yvugenfi@redhat.com, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , si-wei.liu@oracle.com, Jason Wang , "Michael S. Tsirkin" , Dragos Tatulea , Shannon Nelson Subject: [RFC PATCH 12/12] vhost: Allow _F_RING_RESET with shadow virtqueue Date: Thu, 20 Jul 2023 20:14:59 +0200 Message-Id: <20230720181459.607008-13-eperezma@redhat.com> In-Reply-To: <20230720181459.607008-1-eperezma@redhat.com> References: <20230720181459.607008-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.6 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+importer=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_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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1689877007233100005 This is needed to let CVQ restore at the beginning. Not properly tested with actual guest ring reset, only with the reset from qemu. For this to be included, more test is needed, but this series is a good start for it. Signed-off-by: Eugenio P=C3=A9rez --- hw/virtio/vhost-shadow-virtqueue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-vi= rtqueue.c index 1b1d85306c..6490a98db7 100644 --- a/hw/virtio/vhost-shadow-virtqueue.c +++ b/hw/virtio/vhost-shadow-virtqueue.c @@ -34,6 +34,7 @@ bool vhost_svq_valid_features(uint64_t features, Error **= errp) switch (b) { case VIRTIO_F_ANY_LAYOUT: case VIRTIO_RING_F_EVENT_IDX: + case VIRTIO_F_RING_RESET: continue; =20 case VIRTIO_F_ACCESS_PLATFORM: --=20 2.39.3