Received: by 2002:a05:7412:f690:b0:e2:908c:2ebd with SMTP id ej16csp57401rdb; Wed, 18 Oct 2023 18:14:50 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFZP87WKHSecZfc9RGzmBGCBrRcHQB7MUCbqCMz0RcYmGo6on6oJxQRZnAW2CLjRnhtw63W X-Received: by 2002:a05:6358:c62a:b0:166:a6e3:cb9c with SMTP id fd42-20020a056358c62a00b00166a6e3cb9cmr702085rwb.5.1697678089761; Wed, 18 Oct 2023 18:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697678089; cv=none; d=google.com; s=arc-20160816; b=YNqd/xOzFM/27nnLILmMD7QcWdIq22hG/378B3bh2gC2Is+z7LEPmw8lpdBYZHE5aW V8FkBoctWKgcAdgHYp8gJ7CUij4M28OFH6jKZkbPoZAH07AmmYujk6kTqNrwQNbdW+Jm oTN+oTnF4aVWfPWrl88LGGroeqd3orx+G2WUS/xswVOa63Q66xJAntJ7CkAPQO+RYrem VxkrYpXwYi64OCXdpI4mVDgb5vXbqVpiHCM1l+jyE3IMmmi6ypG9csYEP5v38S1VvsFY +KHWotN4IvTJLIwuWkW6P5l6y/BPxj8y1QGn7kijufy27xFfDteiCi5ZWnsQtn30AcES b4wg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/PCloSFrPiPsydf0JTwMrxT+NyKATOuPJq4OdDBeRMY=; fh=ozy2CkLebIOzbpPF40kmeuF6jbAmH8vZa/HD/EKOE2c=; b=L6bDOxk6LiKZc8keCOtP9JpjI1ogkbnWdbh/Ugy4qhDHfBQccQ19NfqLrM/0Z2woDT qWu8pEN6i7EOm4q1AORExH/idVpAxHHeK5UdxDiOukvbQ7slJhNo7HnTXrU8vZcNyYWg OyykJHK1/4/xC6o0LP4jcTJ2mBQY6lFEO8C47ARiiaHbmq4HJwQWDcK3bp5qDD79m4Z7 Q+37FGH0J5Dk4arx5mlzvrH1SeuU3PAoyKC1qxDBO6WRiLUVWnm3O0Ch3kB2Y28K93M3 24px+kAsxDC6WoAG0o1mSBZ85G/T84DfFcqiJ3I/An01oU18QixFeXS8nCDWy9rDJSs+ xceQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=SBbPFARm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id y67-20020a636446000000b0059d25cedc71si3397135pgb.757.2023.10.18.18.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 18:14:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=SBbPFARm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 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 pete.vger.email (Postfix) with ESMTP id 1F2568168208; Wed, 18 Oct 2023 18:14:44 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232332AbjJSBNR (ORCPT + 99 others); Wed, 18 Oct 2023 21:13:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232164AbjJSBNJ (ORCPT ); Wed, 18 Oct 2023 21:13:09 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 036AB118 for ; Wed, 18 Oct 2023 18:13:04 -0700 (PDT) Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39IIn39G027695; Thu, 19 Oct 2023 01:12:58 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-type : content-transfer-encoding; s=corp-2023-03-30; bh=/PCloSFrPiPsydf0JTwMrxT+NyKATOuPJq4OdDBeRMY=; b=SBbPFARm70GVdtnRruwwiEyo/BIXZt0nc6N8HEqd3iHY4kKUtpPTrSgypFiA2IbHdgmB FbDNOVYioxrsfnaDSjqSFSH9r0MmDt3V0vzqYh2gCwclUDcN5ZW/+fkBrrPvFXH7trs5 aHBT+Z4v7tcZzonvWN2Cdqa4yweG9eiAKwERSQqre0D8wM+zJ4QTE7ekjOzgOne7NhRW 89exBsT77wL1jeu3dGTqz+BtqogZI8rMjfXE//j15BpPHLlPruyz1wCyB4X2V8XnV7W2 aB+VyKIB6dXLO2tTBwhEqWM10+KdkOIIz6HiLY9qLip/CofoGRaFx67gI7Pg3rbdJqcT DA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tqk1bs077-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 19 Oct 2023 01:12:58 +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 39J0UpRx015251; Thu, 19 Oct 2023 01:12:57 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 3trg1h8w2d-1; Thu, 19 Oct 2023 01:12:57 +0000 From: Si-Wei Liu To: jasowang@redhat.com, mst@redhat.com, eperezma@redhat.com, sgarzare@redhat.com, dtatulea@nvidia.com Cc: virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/4] vdpa: decouple reset of iotlb mapping from device reset Date: Wed, 18 Oct 2023 18:10:13 -0700 Message-Id: <1697677818-11371-1-git-send-email-si-wei.liu@oracle.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-19_01,2023-10-18_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 phishscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310190007 X-Proofpoint-GUID: n2aFvESP-ekmGpSKgu-1r01yI1PXzw4b X-Proofpoint-ORIG-GUID: n2aFvESP-ekmGpSKgu-1r01yI1PXzw4b X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Wed, 18 Oct 2023 18:14:44 -0700 (PDT) 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 rebased on top of the latest vhost tree. [1] Reducing vdpa migration downtime because of memory pin / maps https://www.mail-archive.com/qemu-devel@nongnu.org/msg953755.html --- v3: - add .reset_map support to vdpa_sim - introduce module parameter to provide bug-for-bug compatiblity with older userspace v2: - improved commit message to clarify the intended csope of .reset_map API - improved commit messages to clarify no breakage on older userspace 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 (5): 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 vdpa_sim: implement .reset_map support drivers/vdpa/mlx5/core/mlx5_vdpa.h | 1 + drivers/vdpa/mlx5/core/mr.c | 17 +++++++++ drivers/vdpa/mlx5/net/mlx5_vnet.c | 26 ++++++++++++-- drivers/vdpa/vdpa_sim/vdpa_sim.c | 58 ++++++++++++++++++++++++------ drivers/vhost/vdpa.c | 31 ++++++++++++++++ include/linux/vdpa.h | 10 ++++++ include/uapi/linux/vhost_types.h | 2 ++ 7 files changed, 132 insertions(+), 13 deletions(-) -- 2.39.3