Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2366190pxb; Tue, 12 Oct 2021 05:14:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRWVblZO1CUp+k7PIO4U4R0FiiwbDQRllQdLlBxSDRxmUnFuAwHOAOYGrLYhQcgapJzGZE X-Received: by 2002:a17:906:270a:: with SMTP id z10mr31396330ejc.464.1634040872425; Tue, 12 Oct 2021 05:14:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634040872; cv=none; d=google.com; s=arc-20160816; b=bDN45IJYGEul7Z+u1e3epiFNqVgb9QgXxJDOy9U72MM6PEbkFFFqVpOz30/Ag7F9UT ArG5WEG/VOdHZGP8uiHqqPDkTCT8rbU/kVNKZ/dNk5lhPcPFEf+nZleiqFfSD2f4PhvF ROZGik7pi+LmjCnmJ7CRS3PFKJqfsTDqN7hr03GilY1BszCvtcWt1CN5cAN3A6/d9wPO dbydkGkb9bgOYS3zeKc5lk5MLvgAZrY2kQBSGXYQJ6hNvb821Y2YalhTVGehASC5U2MQ BsSCH6GycqRLNeKVF2NZal6h7y4pQsYAtQ/meiZ4XZeulFNra7U+JN8Hdhjrv1l9IcwO h1BQ== 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=Cu9aT9PKxubFeRU3gw1Gjtc6Ldb5NRA5s/4pefgZcj0=; b=deCYdZoWqs2LpfwYvQi2hyEXnHIZtHrTs8Eih05iPpJC8PYB6cUFiNAFxQVBmb4pns uAwF83kXqOZTvmu5C6i8bXvssvw/Xs3DSUP4LVjjMg0rJ4tDZqIGbNS5T4k/juV7Gt+t rq61q1yTdiqAJmp2APIc7Wl/1Ctbc6HZHipv+jExUmd3rWFxN0qgqwNKPTObIJvecPjX mjSjxNU4HhhWd43mbfgoYUfwggnKifms7PEIvH8d2FXIhCbQGfpim/IeC6R9Y+3tUNJy /LuwdHqGO4ZtMbfV/AnpvKnWR2CTPUyAFP972nTADhtFB5AsydF/TpUptcHOCPL3r/Hf A4sA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=QRa8JGzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y11si16130076edi.152.2021.10.12.05.13.51; Tue, 12 Oct 2021 05:14:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=QRa8JGzO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236326AbhJLMLa (ORCPT + 99 others); Tue, 12 Oct 2021 08:11:30 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:13763 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232665AbhJLML3 (ORCPT ); Tue, 12 Oct 2021 08:11:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1634040568; x=1665576568; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Cu9aT9PKxubFeRU3gw1Gjtc6Ldb5NRA5s/4pefgZcj0=; b=QRa8JGzONRKvpfdfZGJxZ+Zljhht969ejd/GrHt3qSmtov5LQIJG9M9r KhWp5Y0VQ+n3j2IGRspJ1+DxIT3CenxA2gwTgYhMzACNL+zfUuq3HfI1a QkrC9VcDp52rPSRGAenripZUM0XG9Q2SngxAgm7cG29C7aYUXR2s5u0rK 4=; X-IronPort-AV: E=Sophos;i="5.85,367,1624320000"; d="scan'208";a="147112800" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-iad-1d-1c682de1.us-east-1.amazon.com) ([10.43.8.2]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP; 12 Oct 2021 12:09:19 +0000 Received: from EX13D13EUA004.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-iad-1d-1c682de1.us-east-1.amazon.com (Postfix) with ESMTPS id 98058A20F0; Tue, 12 Oct 2021 12:09:16 +0000 (UTC) Received: from EX13MTAUEA002.ant.amazon.com (10.43.61.77) by EX13D13EUA004.ant.amazon.com (10.43.165.22) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 12 Oct 2021 12:09:15 +0000 Received: from 8c85908914bf.ant.amazon.com.com (10.1.212.21) by mail-relay.amazon.com (10.43.61.169) with Microsoft SMTP Server id 15.0.1497.23 via Frontend Transport; Tue, 12 Oct 2021 12:09:11 +0000 From: Gal Pressman To: Sumit Semwal , =?UTF-8?q?Christian=20K=C3=B6nig?= , Doug Ledford , Jason Gunthorpe CC: , , , , Oded Gabbay , Tomer Tayar , Yossi Leybovich , Alexander Matushevsky , Leon Romanovsky , Jianxin Xiong , Firas Jahjah , Gal Pressman Subject: [PATCH for-next 0/3] EFA dmabuf memory regions Date: Tue, 12 Oct 2021 15:09:00 +0300 Message-ID: <20211012120903.96933-1-galpress@amazon.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hey all, This is a followup to my previous RFCs [1][2], which now adds a new api to the RDMA subsystem that allows drivers to get a pinned dmabuf memory region without requiring an implementation of the move_notify callback. The new api makes use of the dynamic attachment api implemented in the RDMA subsystem, but calls dma_buf_pin() in order to make sure that the callback will not be called, as suggested by Christian. As explained in the previous RFC, move_notify requires the RDMA device to support on-demand-paging (ODP) which is not common on most devices (only supported by mlx5). While the dynamic requirement makes sense for certain GPUs, some devices (such as habanalabs) have device memory that is always "pinned" and do not need/use the move_notify operation. Patch #1 changes the dmabuf documentation to make it clear that pinning does not necessarily mean the memory must be moved to system memory, it is up to the exporter to decide. Patch #2 adds the RDMA api that allows drivers to get pinned dmabuf memory regions. Patch #3 adds the EFA implementation of the dmabuf importer. The motivation of this submission is to use habanalabs as the dmabuf exporter, and EFA as the importer to allow for peer2peer access through libibverbs. [1] https://lore.kernel.org/linux-rdma/20210818074352.29950-1-galpress@amazon.com/ [2] https://lore.kernel.org/linux-rdma/20211007104301.76693-1-galpress@amazon.com/ Thanks Gal Pressman (3): dma-buf: Fix pin callback comment RDMA/umem: Allow pinned dmabuf umem usage RDMA/efa: Add support for dmabuf memory regions drivers/infiniband/core/umem_dmabuf.c | 51 +++++++++++ drivers/infiniband/hw/efa/efa.h | 4 + drivers/infiniband/hw/efa/efa_main.c | 1 + drivers/infiniband/hw/efa/efa_verbs.c | 127 +++++++++++++++++++------- include/linux/dma-buf.h | 4 +- include/rdma/ib_umem.h | 12 +++ 6 files changed, 166 insertions(+), 33 deletions(-) -- 2.33.0