Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp155195rda; Sat, 21 Oct 2023 02:29:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEE/K51XUtXNqJKxsLC0u7pTrDAfNfYQqhJqtLPf95KRx/t5Uqo5Dgr4QjLhJh5hez+joM9 X-Received: by 2002:aa7:88cd:0:b0:6b8:a6d6:f51a with SMTP id k13-20020aa788cd000000b006b8a6d6f51amr5110729pff.31.1697880546241; Sat, 21 Oct 2023 02:29:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697880546; cv=none; d=google.com; s=arc-20160816; b=eTweo/6V9N/9FlMN4GQIZBmlj8PcvLYr/e4RG2h5yDb42Hwub1a4tNzMGWriUgQZkd dWBPbcnPnkOadPsRz4FMRjnVauULDk3bwzcGi4rbPz6a0ImJQt/2nLYDUme6vTrO0kr/ XG10Ye6QrLOOF6bcFRAE2sqEYA38jPMaBykVY3YLexwk6Fc88CYZ6yg2OJAJE9JfPfO2 5iwVaFOyfJBEWUgoogfHJPvcQTJ97ZrjENV7ZhNM4BtYEv0uQqfY9w++iKbRqbN3iea2 dTMjSQaiUcEi0slzNt2QngNlydOaTpQ7oIX8b2X3qNDcilW8jD/1NLjQezea+9LW+mH4 onFA== 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=vXJHNbSFXSISHev3zlx79ZCGYnD++jfw2/gKRC3j7mM=; fh=ozy2CkLebIOzbpPF40kmeuF6jbAmH8vZa/HD/EKOE2c=; b=GKgBHBfCQybtg6rB19lOK0dhZ9J5xSsUq+foSY1HJex1udlC/8VaVi/U2i8JVwyGqS nwwoA/QxgPbev+yaKsjkB2a9JayhOKbaMZsojqvO1oNUYk0I4EOH1lbYKtnMHnvzFVby dQYHZvjXWTvQ42QFnBernrXkBr52tYi3bQq7GbkMm8UVu4eIHeT845Xi3+qDi8QAx+/Y fWR/9vz8iUNDqEYEVDSN9ZPqlAndzULSxNApNV74J6ZoicsjU8Q2bDwxB0oJ/3iKo5tW UsOrwBrlR4quX/xJoxw2SNt9mg3n9bVcZnwF2gDEZhv7Q/N6JRnqulYelLJEtEicsn9K PAAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=UoCbAFz1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id h10-20020a056a00218a00b0068fcf6fe22csi3446228pfi.304.2023.10.21.02.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 Oct 2023 02:29:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=UoCbAFz1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 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 lipwig.vger.email (Postfix) with ESMTP id 5A8CE8226F4F; Sat, 21 Oct 2023 02:28:58 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230200AbjJUJ2b (ORCPT + 99 others); Sat, 21 Oct 2023 05:28:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229472AbjJUJ22 (ORCPT ); Sat, 21 Oct 2023 05:28:28 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0DD1B0 for ; Sat, 21 Oct 2023 02:28:23 -0700 (PDT) Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39L5eAj6008978; Sat, 21 Oct 2023 09:28:19 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=vXJHNbSFXSISHev3zlx79ZCGYnD++jfw2/gKRC3j7mM=; b=UoCbAFz1PpfdKCiAzA5FgvmBx74jQ8ve93i8OtBeiTJX6NeOT1L075fbUaZPSDr/pjih rbIEoG+PEw8t7a68TM8uLY9TqEj83aGybAtxTlBgUgt5Z7zKUFTG7rmU5K5PT3AjJIca rXjHxKqtshKtVaFHb7dNiw5LuMjNgAByjEEG1LRAK/sDCYl1csODGKk3iL0dz26meJvb Xehrn7Tx0cM7pFK23+f51PNzXxNkhj5WQK4N4xO9c3rRJaU3nGSYr8QPEqKNHBJKMdjL HX+CwmNBS0eHJ+xuYg9FMwxGaJLO7N05PAE8ahHAgxjUkcy8N5hDqoyNjnep4ACCvUcT Bg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tv68t8c2a-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 21 Oct 2023 09:28:18 +0000 Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39L6FU68019120; Sat, 21 Oct 2023 09:28:18 GMT Received: from ban25x6uut24.us.oracle.com (ban25x6uut24.us.oracle.com [10.153.73.24]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3tv532gf44-1; Sat, 21 Oct 2023 09:28:18 +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 v4 0/7] vdpa: decouple reset of iotlb mapping from device reset Date: Sat, 21 Oct 2023 02:25:12 -0700 Message-Id: <1697880319-4937-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-20_10,2023-10-19_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 malwarescore=0 bulkscore=0 mlxscore=0 suspectscore=0 phishscore=0 adultscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2310170001 definitions=main-2310210086 X-Proofpoint-ORIG-GUID: OcUBGy1t-QNztFdDrpMctnzrON55byEh X-Proofpoint-GUID: OcUBGy1t-QNztFdDrpMctnzrON55byEh 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Sat, 21 Oct 2023 02:28:58 -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 --- v4: - Rework compatibility using new .compat_reset driver op v3: - add .reset_map support to vdpa_sim - introduce module parameter to provide bug-for-bug compatibility 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 (7): 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: introduce .compat_reset operation callback vhost-vdpa: clean iotlb map during reset for older userspace 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 | 27 ++++++++++++++-- drivers/vdpa/vdpa_sim/vdpa_sim.c | 52 ++++++++++++++++++++++++------ drivers/vhost/vdpa.c | 49 +++++++++++++++++++++++++--- drivers/virtio/virtio_vdpa.c | 2 +- include/linux/vdpa.h | 30 +++++++++++++++-- include/uapi/linux/vhost_types.h | 2 ++ 8 files changed, 161 insertions(+), 19 deletions(-) -- 2.39.3