From patchwork Tue Oct 15 15:23:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yonatan Maman X-Patchwork-Id: 13836617 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA2F4D1D878 for ; Tue, 15 Oct 2024 15:24:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5CB2A6B0093; Tue, 15 Oct 2024 11:24:40 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 57B876B0095; Tue, 15 Oct 2024 11:24:40 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3F4B96B0096; Tue, 15 Oct 2024 11:24:40 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1DD016B0093 for ; Tue, 15 Oct 2024 11:24:40 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id ABAC91214A3 for ; Tue, 15 Oct 2024 15:24:31 +0000 (UTC) X-FDA: 82676208468.12.86F05B6 Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2057.outbound.protection.outlook.com [40.107.243.57]) by imf14.hostedemail.com (Postfix) with ESMTP id 1440E10000C for ; Tue, 15 Oct 2024 15:24:27 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=LHMbqxL0; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf14.hostedemail.com: domain of ymaman@nvidia.com designates 40.107.243.57 as permitted sender) smtp.mailfrom=ymaman@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729005734; h=from:from:sender: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:dkim-signature; bh=edElnGBClLAiAIzr2HyoPLhOZQadZKfGUs1gCkMRJUw=; b=1JwILcrM5eUZxGx2IhM5bjA8AZQnyb8K5tOG1RKadkXoHOi6XvkJzB9d1zN/Dfos/NP1ke EAVoR/9MAY088/B8laysGzKPhVKX2M0DKV8oiZ0Iz9qBbUXFvoe0C4kvtow8qt28hnrOLG 0+8cpIPOJEjvoMRZGAntLVVlYMCsivY= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729005734; a=rsa-sha256; cv=pass; b=M54S+sKUHRbSTXZE+RmGnJXbwS+JYYoAvGLhAaB0SLkp0N/CpzYV2WxnBhjQ53kgbCcyZd ytOfVnjHVqZLP40vRAKUjlglf3/qUQRhS5m7qnDuPkiC4vyJSCZkveTlMV/HIpIju+XCHa rcXlVfHoDAKlOq1XzX+GOcbqPh3ElEg= ARC-Authentication-Results: i=2; imf14.hostedemail.com; dkim=pass header.d=Nvidia.com header.s=selector2 header.b=LHMbqxL0; arc=pass ("microsoft.com:s=arcselector10001:i=1"); spf=pass (imf14.hostedemail.com: domain of ymaman@nvidia.com designates 40.107.243.57 as permitted sender) smtp.mailfrom=ymaman@nvidia.com; dmarc=pass (policy=reject) header.from=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=BczGfVw2kiHqT6X4uX2ZvTRAN2vzGXTe2+5IPBG30OJ16PdJPVpTADLe+TpijcTjXA5ydE99zjrrqES8pMfKl/KgSmLIqPRnWl/yVM4WCnU2gkyVfCFe0P/SVFJ37Zj6YxWwUlw54QJfd0EpnEm/ieRdg1RVWEzpAVkJ+oSdFV3GtnqDT04r1Vw8cydMUAiNCWn1i7p4OHcMgyh51NRL+hCvZp7+FxNDx1Rvtj+ALjonYIhJ06dh2qZf1WG67gyQJE+WgmjFvLFuMUSfWK8HoY5LutpN5Q+B39xULHeIOy+oWO8Zhpnoyw01uxXJBteCo7Ge8Hicbi4iYRUgowh81g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=edElnGBClLAiAIzr2HyoPLhOZQadZKfGUs1gCkMRJUw=; b=KZOH1lJzBDItjPztpavhm18cE9S/7jgbhWjC0Sxni1NqXwhw3sx1ourLHhtClryGVN9sz/2yfV//5DA/ALWl+wyAaBXDCYOYfvMTfIOSzkHKJXD+3/+x313VRoBNKLDpL7V8/YNYQD8uYfQ6GaNnpAM0/XxH7kVwnjVks55GtjOaGsrEs1DHXjnkXSosgTTLYgUGxjGiYIDFvkm3Bm9aPnIIYuXssgT3jHm6uAzsiHGwo6M2aR/ZKcf521FMc7HM0nnFaO3Wwmrf8AZitYyh3NUZmBNMANMRr3x26OJWnyLjMNhSmD8ALzkWVISjJ3Ep8d0xtkNIxTyeTSzRHZlDEA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=lists.freedesktop.org smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=edElnGBClLAiAIzr2HyoPLhOZQadZKfGUs1gCkMRJUw=; b=LHMbqxL0uTpeNiT6Y/2KX/xEVbGKUNzG1aqI0iMpcbvloHdzx2b+sdIz2XsBk/cLjZLE6guetblQskzqpPeJd3uW7QDSyOB6sd9tmNNOcKccFampyhtrpDlMprCmSRRq2JvNj3QUHoeM4ZMTmvLwjdJZTjRqRfFc2VxCsmlPoSqKB6HKahuRsGjt14iwxIkbwajThE8YAst5/EmuT/0A2CU43BPT44u4959oy2NzYJPLB2Kad96VmR9mUrbkV07pJdEIfnOz8pesVrwZpb2n+Tqj2qkP8QD1Tw5heV+Ejqmmut3gCqe6Nq0znjzgbnFKe/wexCfG+u9Dsa1pAq7Cuw== Received: from MW2PR16CA0034.namprd16.prod.outlook.com (2603:10b6:907::47) by PH8PR12MB6819.namprd12.prod.outlook.com (2603:10b6:510:1ca::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.16; Tue, 15 Oct 2024 15:24:31 +0000 Received: from SJ5PEPF000001D0.namprd05.prod.outlook.com (2603:10b6:907:0:cafe::55) by MW2PR16CA0034.outlook.office365.com (2603:10b6:907::47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27 via Frontend Transport; Tue, 15 Oct 2024 15:24:30 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by SJ5PEPF000001D0.mail.protection.outlook.com (10.167.242.52) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.17 via Frontend Transport; Tue, 15 Oct 2024 15:24:30 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 15 Oct 2024 08:24:15 -0700 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Tue, 15 Oct 2024 08:24:15 -0700 Received: from vdi.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Tue, 15 Oct 2024 08:24:11 -0700 From: Yonatan Maman To: , , , , , , , , , , , , , , , CC: Yonatan Maman , Gal Shalom Subject: [PATCH v1 3/4] IB/core: P2P DMA for device private pages Date: Tue, 15 Oct 2024 18:23:47 +0300 Message-ID: <20241015152348.3055360-4-ymaman@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241015152348.3055360-1-ymaman@nvidia.com> References: <20241015152348.3055360-1-ymaman@nvidia.com> MIME-Version: 1.0 X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001D0:EE_|PH8PR12MB6819:EE_ X-MS-Office365-Filtering-Correlation-Id: 3e92872e-9f3d-418a-f069-08dced2d7731 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|36860700013|376014|82310400026|7416014|1800799024|921020; X-Microsoft-Antispam-Message-Info: 41tq66SQC9BvA+ZxClDXTtEFy2mvOJ0ssmBFrOYs1l89eCSNlpsFKp2jCJNsn0hP/BgSFrTPTFiqVg5HXJG0lYHl1bgIt+FB48h5mM9Vyookr3EjXC+hQcOJGS7j8fAtLKyFKwJf3N8nILhwtJtOSNGniWTsv5S8556K8DxF0fwS1auMhqcUIZz2x9Dz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HDPETouAAV/IMt4ZjCAIuwh9JjvFsUFx2YH9nzvBr7FViET4LAcV/kYH37FLPobzcjfeCvuQM+Ffy1I2w+dOpDvHTYjCifKuNv/ouqOp3z00lxNKZmZCbKdylMixQdGZplqvt/9u X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230040)(36860700013)(376014)(82310400026)(7416014)(1800799024)(921020);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Oct 2024 15:24:30.8684 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 3e92872e-9f3d-418a-f069-08dced2d7731 X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: SJ5PEPF000001D0.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6819 X-Rspamd-Queue-Id: 1440E10000C X-Stat-Signature: wpr8g73a5ssb9zrw8rt9ywg4krebrm71 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1729005867-295373 X-HE-Meta: U2FsdGVkX1++IWgm/mvA55Gh/P8G5kIzJn9jTY8qxnD1SKwR2FL6vEaRGRLDHcuNeU056Z7oUgFa42AG05HZzK42bJo2YDl1F7C00TKvZePKlBCo7X7kbw59If5jGoXHmO11/IVLA/+s0i/Jw9F6T1MKBSrA3a8E+bOzjEIaPCcY1rb0xN9UefViSArKETXh3b2GlSvOpwVbliiAzzaAbGaCRGnPX4Js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mpztBZPnPm5ukx+zvKQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Yonatan Maman Add Peer-to-Peer (P2P) DMA request for hmm_range_fault calling, utilizing capabilities introduced in mm/hmm. By setting range.default_flags to HMM_PFN_REQ_FAULT | HMM_PFN_REQ_TRY_P2P, HMM attempts to initiate P2P DMA connections for device private pages (instead of page fault handling). This enhancement utilizes P2P DMA to reduce performance overhead during data migration between devices (e.g., GPU) and system memory, providing performance benefits for GPU-centric applications that utilize RDMA and device private pages. Signed-off-by: Yonatan Maman Reviewed-by: Gal Shalom --- drivers/infiniband/core/umem_odp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c index e9fa22d31c23..1f6498d26df4 100644 --- a/drivers/infiniband/core/umem_odp.c +++ b/drivers/infiniband/core/umem_odp.c @@ -381,7 +381,7 @@ int ib_umem_odp_map_dma_and_lock(struct ib_umem_odp *umem_odp, u64 user_virt, pfn_start_idx = (range.start - ib_umem_start(umem_odp)) >> PAGE_SHIFT; num_pfns = (range.end - range.start) >> PAGE_SHIFT; if (fault) { - range.default_flags = HMM_PFN_REQ_FAULT; + range.default_flags = HMM_PFN_REQ_FAULT | HMM_PFN_REQ_ALLOW_P2P; if (access_mask & ODP_WRITE_ALLOWED_BIT) range.default_flags |= HMM_PFN_REQ_WRITE;