Message ID | 1696928580-7520-1-git-send-email-si-wei.liu@oracle.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp57292vqb; Tue, 10 Oct 2023 02:06:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHqndfBAeX0z7XGq6atLryvitdOzKj5c8ZRocS22z3iK4MiHe4cy/xN9OjbpeSG7nYCIYQw X-Received: by 2002:a17:902:e5c7:b0:1c6:ec8:4c67 with SMTP id u7-20020a170902e5c700b001c60ec84c67mr17175609plf.18.1696928786949; Tue, 10 Oct 2023 02:06:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696928786; cv=none; d=google.com; s=arc-20160816; b=d80W+BGMIguXTXXaKW1c/APXcwOSpOU0Bis4yh/pZjufwOt2S5GQmVnrmkrbtXCd8h EqulZVRQVyTIMeSMG1IZDKdX5gNZzp01OvYzAFCphGVgcR56BNx28DRfZ6+X78WidYXH idh8OFcQeKWL8f/42/2uAwVBIDWENHsdNjDptS/DXgJBTl4Mm4dWn3Zj0+YqP3kHv+mm fsSmlLx/1c91vpAjntpLg+dg/I653m3k/jKAchwtEgcogFwn5xuVzRXSauFeDeG+8W0Z AcA+bIDHWEGI4FFwtdVjwvsVjcc7p6VHb/YIHyWhp61QjbNh+XavrJGNTH3JEmmRFoju qx+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=V9hW5xCiXKTlut56vA+Ni1Kl2uT76zDTn5zdh6DLiTc=; fh=FYvCndxPQizgygd8hAQJp2i0SXZazO8uVJMWtxk8XU4=; b=S6kVbYj+A1kCVQoLuKKFCm5tNpJDDSzdy0nJuwzwBTZHZ3oHOQ1oQF1rH8Zooedc3a O1OBFO8l7X9I2XdGYLkT4St+UzDZcizOaXJ1gBRPax//0P8+CK8YGRQ4sZgP5drMapWc KyFD6ufciDZCbSZVQnAlyku0kKu8VOksYZpTCjITIcqheA2vhLyCqaUKvs1cf+depub2 5ovHq8BDkVcRPDXTkGrnDer+X2YVOKIsnMr6nzbVUD8iupHnusPNIiFOBlBdYNm4IY5a llftFcUueyb3y1/HEjeV/1BH0D11WGBPeebjd0E7fhqPZPTgD7KEYpDGY17+zsnxs+5c Pv4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=w9y8s1ug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id ko16-20020a17090307d000b001c7361b71c9si11136704plb.114.2023.10.10.02.06.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Oct 2023 02:06:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=w9y8s1ug; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id EEF2E8329A96; Tue, 10 Oct 2023 02:06:19 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229870AbjJJJGB (ORCPT <rfc822;rua109.linux@gmail.com> + 20 others); Tue, 10 Oct 2023 05:06:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229695AbjJJJFt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 10 Oct 2023 05:05:49 -0400 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D2C4A9 for <linux-kernel@vger.kernel.org>; Tue, 10 Oct 2023 02:05:48 -0700 (PDT) Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39A800V7017503; Tue, 10 Oct 2023 09:05:36 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2023-03-30; bh=V9hW5xCiXKTlut56vA+Ni1Kl2uT76zDTn5zdh6DLiTc=; b=w9y8s1ugO04ALPsNP6Cg6U4csoUtVhu2xwJnClmxPWIJ50FoUdUeBLFuBM9Aism5BUH0 zry4gQhoEt+6MsYCKiIbtr/ytI9AyfSs0EY6EtddJReTNX932O7d3GVDbgx+p8Nn/Hiw rTsbDOO74fcRtiLK27rmH0Nv7Hx/nZIC1myhoyEtMtKyRV85vjZqKxzUyCoE/X+HnxFF my8tkPMqKJnKSeef+dAVCFeC4Fxsjrk4C/Vqwb+DXSR+gJITYgW1auXDchu2jUogQUSd L2TSM4l2qdq39u+y4J7VJgU9yKwYvwAEM+QrEM1BoCzrm2wl19ibfNI6Myyr8jZ1fuo+ Cw== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tjx8cck99-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 10 Oct 2023 09:05:35 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39A6sxrC021395; Tue, 10 Oct 2023 09:05:34 GMT Received: from ban25x6uut24.us.oracle.com (ban25x6uut24.us.oracle.com [10.153.73.24]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3tjwsc5cy2-1; Tue, 10 Oct 2023 09:05:34 +0000 From: Si-Wei Liu <si-wei.liu@oracle.com> To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com, xuanzhuo@linux.alibaba.com, dtatulea@nvidia.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/4] vdpa: decouple reset of iotlb mapping from device reset Date: Tue, 10 Oct 2023 02:02:56 -0700 Message-Id: <1696928580-7520-1-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-10_04,2023-10-09_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 suspectscore=0 malwarescore=0 adultscore=0 spamscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310100067 X-Proofpoint-ORIG-GUID: 8Ide89K5gZkO8He6usVpDSFLh-m0Q4Np X-Proofpoint-GUID: 8Ide89K5gZkO8He6usVpDSFLh-m0Q4Np X-Spam-Status: No, score=2.7 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Tue, 10 Oct 2023 02:06:20 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779358799161939680 X-GMAIL-MSGID: 1779358799161939680 |
Series |
vdpa: decouple reset of iotlb mapping from device reset
|
|
Message
Si-Wei Liu
Oct. 10, 2023, 9:02 a.m. UTC
In order to reduce needlessly high setup and teardown cost of iotlb mapping during live migration, it's crucial to decouple the vhost-vdpa iotlb abstraction from the virtio device life cycle, i.e. iotlb mappings should be left intact across virtio device reset [1]. For it to work, the on-chip IOMMU parent device could implement a separate .reset_map() operation callback to restore 1:1 DMA mapping without having to resort to the .reset() callback, the latter of which is mainly used to reset virtio device state. This new .reset_map() callback will be invoked only before the vhost-vdpa driver is to be removed and detached from the vdpa bus, such that other vdpa bus drivers, e.g. virtio-vdpa, can start with 1:1 DMA mapping when they are attached. For the context, those on-chip IOMMU parent devices, create the 1:1 DMA mapping at vdpa device creation, and they would implicitly destroy the 1:1 mapping when the first .set_map or .dma_map callback is invoked. This patchset is based off of the descriptor group v3 series from Dragos. [2] [1] Reducing vdpa migration downtime because of memory pin / maps https://www.mail-archive.com/qemu-devel@nongnu.org/msg953755.html [2] [PATCH vhost v3 00/16] vdpa: Add support for vq descriptor mappings https://lore.kernel.org/lkml/20231009112401.1060447-1-dtatulea@nvidia.com/ --- v1: - rewrote commit messages to include more detailed description and background - reword to vendor specific IOMMU implementation from on-chip IOMMU - include parent device backend feautres to persistent iotlb precondition - reimplement mlx5_vdpa patch on top of descriptor group series RFC v3: - fix missing return due to merge error in patch #4 RFC v2: - rebased on top of the "[PATCH RFC v2 0/3] vdpa: dedicated descriptor table group" series: https://lore.kernel.org/virtualization/1694248959-13369-1-git-send-email-si-wei.liu@oracle.com/ --- Si-Wei Liu (4): vdpa: introduce .reset_map operation callback vhost-vdpa: reset vendor specific mapping to initial state in .release vhost-vdpa: introduce IOTLB_PERSIST backend feature bit vdpa/mlx5: implement .reset_map driver op drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + drivers/vdpa/mlx5/core/mr.c | 17 +++++++++++++++++ drivers/vdpa/mlx5/net/mlx5_vnet.c | 18 +++++++++++++----- drivers/vhost/vdpa.c | 31 +++++++++++++++++++++++++++++++ include/linux/vdpa.h | 10 ++++++++++ include/uapi/linux/vhost_types.h | 2 ++ 6 files changed, 74 insertions(+), 5 deletions(-)
Comments
On Tue, Oct 10, 2023 at 11:05 AM Si-Wei Liu <si-wei.liu@oracle.com> wrote: > > In order to reduce needlessly high setup and teardown cost > of iotlb mapping during live migration, it's crucial to > decouple the vhost-vdpa iotlb abstraction from the virtio > device life cycle, i.e. iotlb mappings should be left > intact across virtio device reset [1]. For it to work, the > on-chip IOMMU parent device could implement a separate > .reset_map() operation callback to restore 1:1 DMA mapping > without having to resort to the .reset() callback, the > latter of which is mainly used to reset virtio device state. > This new .reset_map() callback will be invoked only before > the vhost-vdpa driver is to be removed and detached from > the vdpa bus, such that other vdpa bus drivers, e.g. > virtio-vdpa, can start with 1:1 DMA mapping when they > are attached. For the context, those on-chip IOMMU parent > devices, create the 1:1 DMA mapping at vdpa device creation, > and they would implicitly destroy the 1:1 mapping when > the first .set_map or .dma_map callback is invoked. > > This patchset is based off of the descriptor group v3 series > from Dragos. [2] > > [1] Reducing vdpa migration downtime because of memory pin / maps > https://www.mail-archive.com/qemu-devel@nongnu.org/msg953755.html > [2] [PATCH vhost v3 00/16] vdpa: Add support for vq descriptor mappings > https://lore.kernel.org/lkml/20231009112401.1060447-1-dtatulea@nvidia.com/ > Acked-by: Eugenio Pérez <eperezma@redhat.com> Thanks! > --- > v1: > - rewrote commit messages to include more detailed description and background > - reword to vendor specific IOMMU implementation from on-chip IOMMU > - include parent device backend feautres to persistent iotlb precondition > - reimplement mlx5_vdpa patch on top of descriptor group series > > RFC v3: > - fix missing return due to merge error in patch #4 > > RFC v2: > - rebased on top of the "[PATCH RFC v2 0/3] vdpa: dedicated descriptor table group" series: > https://lore.kernel.org/virtualization/1694248959-13369-1-git-send-email-si-wei.liu@oracle.com/ > > --- > > Si-Wei Liu (4): > vdpa: introduce .reset_map operation callback > vhost-vdpa: reset vendor specific mapping to initial state in .release > vhost-vdpa: introduce IOTLB_PERSIST backend feature bit > vdpa/mlx5: implement .reset_map driver op > > drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + > drivers/vdpa/mlx5/core/mr.c | 17 +++++++++++++++++ > drivers/vdpa/mlx5/net/mlx5_vnet.c | 18 +++++++++++++----- > drivers/vhost/vdpa.c | 31 +++++++++++++++++++++++++++++++ > include/linux/vdpa.h | 10 ++++++++++ > include/uapi/linux/vhost_types.h | 2 ++ > 6 files changed, 74 insertions(+), 5 deletions(-) > > -- > 1.8.3.1 >