From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.3 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C05EC4320E for ; Tue, 24 Aug 2021 09:06:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F4A561374 for ; Tue, 24 Aug 2021 09:06:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235532AbhHXJHQ (ORCPT ); Tue, 24 Aug 2021 05:07:16 -0400 Received: from smtp-fw-9103.amazon.com ([207.171.188.200]:9239 "EHLO smtp-fw-9103.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230159AbhHXJHK (ORCPT ); Tue, 24 Aug 2021 05:07:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1629795986; x=1661331986; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=rnUhlHPoIJ2Phd42u7TjZjB5NMBB69P1r79MOcj/MTY=; b=PqZtOs1BBeDI2ajiL2U13PCv0cbPnEhAsnmMlFjsW/opFIeIMA87CXWp 8QhoB9H802isljSpB+oTknIWK3ikPwincD40Xc2uLURqyYGR4Azys0MQo VoJvo36pZKdwSY1+dily67wCmOMfEa96x1pNaUXyB1NsUyRmjQcxcdXOo E=; X-IronPort-AV: E=Sophos;i="5.84,346,1620691200"; d="scan'208";a="952569221" Received: from pdx4-co-svc-p1-lb2-vlan2.amazon.com (HELO email-inbound-relay-1e-28209b7b.us-east-1.amazon.com) ([10.25.36.210]) by smtp-border-fw-9103.sea19.amazon.com with ESMTP; 24 Aug 2021 09:06:18 +0000 Received: from EX13D19EUB003.ant.amazon.com (iad12-ws-svc-p26-lb9-vlan3.iad.amazon.com [10.40.163.38]) by email-inbound-relay-1e-28209b7b.us-east-1.amazon.com (Postfix) with ESMTPS id 3FB57BFD9A; Tue, 24 Aug 2021 09:06:12 +0000 (UTC) Received: from 8c85908914bf.ant.amazon.com (10.43.162.216) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 24 Aug 2021 09:06:05 +0000 Subject: Re: [RFC] Make use of non-dynamic dmabuf in RDMA To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Jason Gunthorpe CC: Daniel Vetter , Sumit Semwal , Doug Ledford , "open list:DMA BUFFER SHARING FRAMEWORK" , dri-devel , Linux Kernel Mailing List , linux-rdma , Oded Gabbay , Tomer Tayar , Yossi Leybovich , Alexander Matushevsky , Leon Romanovsky , Jianxin Xiong , John Hubbard References: <20210818074352.29950-1-galpress@amazon.com> <20210819230602.GU543798@ziepe.ca> <20210820123316.GV543798@ziepe.ca> <0fc94ac0-2bb9-4835-62b8-ea14f85fe512@amazon.com> <20210820143248.GX543798@ziepe.ca> From: Gal Pressman Message-ID: Date: Tue, 24 Aug 2021 12:06:00 +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: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 8bit X-Originating-IP: [10.43.162.216] X-ClientProxiedBy: EX13D10UWA003.ant.amazon.com (10.43.160.248) To EX13D19EUB003.ant.amazon.com (10.43.166.69) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23/08/2021 13:43, Christian König wrote: > Am 21.08.21 um 11:16 schrieb Gal Pressman: >> On 20/08/2021 17:32, Jason Gunthorpe wrote: >>> On Fri, Aug 20, 2021 at 03:58:33PM +0300, Gal Pressman wrote: >>> >>>> Though it would've been nicer if we could agree on a solution that could work >>>> for more than 1-2 RDMA devices, using the existing tools the RDMA subsystem >>>> has. >>> I don't think it can really be done, revoke is necessary, and isn't a >>> primitive we have today. >>> >>> Revoke is sort of like rereg MR, but with a guaranteed no-change to >>> the lkey/rkey >>> >>> Then there is the locking complexity of linking the mr creation and >>> destruction to the lifecycle of the pages, which is messy and maybe >>> not general. For instance mlx5 would call its revoke_mr, disconnect >>> the dmabuf then destroy the mkey - but this is only safe because mlx5 >>> HW can handle concurrent revokes. >> Thanks, that makes sense. >> >>>> That's why I tried to approach this by denying such attachments for non-ODP >>>> importers instead of exposing a "limited" dynamic importer. >>> That is fine if there is no revoke - once revoke exists we must have >>> driver and HW support. >> Agree. >> IIUC, we're talking about three different exporter "types": >> - Dynamic with move_notify (requires ODP) >> - Dynamic with revoke_notify >> - Static >> >> Which changes do we need to make the third one work? > > Basically none at all in the framework. > > You just need to properly use the dma_buf_pin() function when you start using a > buffer (e.g. before you create an attachment) and the dma_buf_unpin() function > after you are done with the DMA-buf. I replied to your previous mail, but I'll ask again. Doesn't the pin operation migrate the memory to host memory?