Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp265467pxb; Wed, 18 Aug 2021 01:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7ItDsXq3ydfbQihUg1K5yK12UpWLFV7z3xwaN8CROtYntTs1VtoB7zAsbK+ZuvUD8W5vE X-Received: by 2002:a05:6e02:964:: with SMTP id q4mr5457640ilt.229.1629275940121; Wed, 18 Aug 2021 01:39:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629275940; cv=none; d=google.com; s=arc-20160816; b=fRLFwYqrDnqVPKqNR1DR7SPddk1aJOSWofMV3K51LnHA+2HIHraEepIJdOdj0UufZ4 OBwL06Vz1Sh4/sezjNPXec3B0g9frVF0p+ZhICFqM9uPGWNO5F8GNE+Mylo+qJTeSAVA m0vTY/heEQCHRto9ShQ1sgy4doYhfh1SVfCGIFUNNH+pXoaZ7R0KKOajvEuwzWmg+jfe Cv1Hr6Wg8tIF9/SFVb2r/96X0VdT1jqdi2CPWLzD37+UsbEI7PvvLuNTJq+hdqNhHRdy DSyUFxJ91kwgX3cUyCrKy4Bg7AUyd5LFRYhChTsSBUdEYmlwNfOlDTede1UBdNPpGlhF mO7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=Cs2eoNXPps/j86YzVA6CeH9OzMSl/g0AtoxGtzsYxzY=; b=XDUTQAbeQmQyqMhXs++Pf4YuHAHZQlSgzk1mJ9QnR6vf7b3epmYJMA2h4oiv7Sy5N4 6kGNjUaqIAcG6X7obE58Q1B90uJqEdirLH5sI33gY8VIuDmNBQRsq39kKttUMR22L6gA Rc6546IcgUsq+/Psghs4Cn4hbBXuM/VDyVIsFsMCEGYBPY/+TH0p0HVFq6fsbP2ICso9 5Jqxz44a/mBSoONEsXvUpWvqChFUD4beKmAbbPe5TzQf79K+viKkkqhh+cC7t5hVQyCI rwSOUYXbhSaJaWwnachiBAKf3VSytUw2pSxMD9pKPFd7/sWhxVksieBeqCQFxGNPh63p HgIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=qSapbQxe; 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 p9si5638901ilo.104.2021.08.18.01.38.49; Wed, 18 Aug 2021 01:39:00 -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=qSapbQxe; 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 S238857AbhHRIin (ORCPT + 99 others); Wed, 18 Aug 2021 04:38:43 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:19281 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237883AbhHRIim (ORCPT ); Wed, 18 Aug 2021 04:38:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1629275889; x=1660811889; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=Cs2eoNXPps/j86YzVA6CeH9OzMSl/g0AtoxGtzsYxzY=; b=qSapbQxehzaU32dJowTQiT9U5GMy1Wr/Wm99Ww4jPUbNgboz3Q6i9sRU M3T48yGXJWEUnzClJfY6llfwzINb++3ADoPka39soto670rtKrRl3Pmy+ l08f/KN4DebOwXOq7TkM8UGxN2ykxof1Ll+lBfkVac4MJUYAzCPA6Rkxu E=; X-IronPort-AV: E=Sophos;i="5.84,330,1620691200"; d="scan'208";a="134675497" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com) ([10.43.8.6]) by smtp-border-fw-6001.iad6.amazon.com with ESMTP; 18 Aug 2021 08:38:01 +0000 Received: from EX13D19EUB003.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-38ae4ad2.us-east-1.amazon.com (Postfix) with ESMTPS id E0809A299E; Wed, 18 Aug 2021 08:37:56 +0000 (UTC) Received: from 8c85908914bf.ant.amazon.com (10.43.160.90) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 18 Aug 2021 08:37:49 +0000 Subject: Re: [RFC] Make use of non-dynamic dmabuf in RDMA To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Sumit Semwal , Doug Ledford , Jason Gunthorpe CC: , , , , Oded Gabbay , Tomer Tayar , Yossi Leybovich , Alexander Matushevsky , Leon Romanovsky , Jianxin Xiong References: <20210818074352.29950-1-galpress@amazon.com> <3abaef49-2733-8b5e-3eaa-662a2a57b96e@amd.com> From: Gal Pressman Message-ID: <01573693-cf7a-a160-2f60-5049dfba1ecd@amazon.com> Date: Wed, 18 Aug 2021 11:37:31 +0300 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <3abaef49-2733-8b5e-3eaa-662a2a57b96e@amd.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.43.160.90] X-ClientProxiedBy: EX13D42UWB003.ant.amazon.com (10.43.161.45) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 18/08/2021 11:00, Christian König wrote: > Am 18.08.21 um 09:43 schrieb Gal Pressman: >> Hey all, >> >> Currently, the RDMA subsystem can only work with dynamic dmabuf >> attachments, which 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. >> >> The motivation of this RFC is to use habanalabs as the dmabuf exporter, >> and EFA as the importer to allow for peer2peer access through libibverbs. >> >> This draft patch changes the dmabuf driver to differentiate between >> static/dynamic attachments by looking at the move_notify op instead of >> the importer_ops struct, and allowing the peer2peer flag to be enabled >> in case of a static exporter. > > Well NAK to the general approach, this can be solved much easier. > > If you can't support dynamic moves while using the buffer then just pin all > buffers during import/export. > > This avoids the move notification and the framework/exporter can still correctly > account for pinned buffers. > > But please note that at least amdgpu never uses P2P support for pinned buffers > since we want to avoid that unmoveable buffers clutter video memory and create > conflicts with V4L and scanout. > > If you don't have such concerns in habanalabs then you can implement the pinning > there while keeping P2P still enabled. Thanks Christian! Are you suggesting to pass an empty move_notify callback instead of passing NULL? Also, doesn't the pin operation move the memory from the device to host memory?