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=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no 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 2BEE0C49EA7 for ; Fri, 25 Jun 2021 07:28:44 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C29146141A for ; Fri, 25 Jun 2021 07:28:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C29146141A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 534116ECDD; Fri, 25 Jun 2021 07:28:43 +0000 (UTC) Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by gabe.freedesktop.org (Postfix) with ESMTPS id 884D86EAB4; Thu, 24 Jun 2021 08:12:42 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 01CD167373; Thu, 24 Jun 2021 10:12:38 +0200 (CEST) Date: Thu, 24 Jun 2021 10:12:37 +0200 From: Christoph Hellwig To: Christian =?iso-8859-1?Q?K=F6nig?= Subject: Re: [Linaro-mm-sig] [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF Message-ID: <20210624081237.GA30289@lst.de> References: <20210622154027.GS1096940@ziepe.ca> <09df4a03-d99c-3949-05b2-8b49c71a109e@amd.com> <20210622160538.GT1096940@ziepe.ca> <20210623182435.GX1096940@ziepe.ca> <20210623185045.GY1096940@ziepe.ca> <20210624053421.GA25165@lst.de> <9571ac7c-3a58-b013-b849-e26c3727e9b2@amd.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <9571ac7c-3a58-b013-b849-e26c3727e9b2@amd.com> User-Agent: Mutt/1.5.17 (2007-11-01) X-Mailman-Approved-At: Fri, 25 Jun 2021 07:28:40 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Oded Gabbay , linux-rdma , Christian =?iso-8859-1?Q?K=F6nig?= , sleybo@amazon.com, Oded Gabbay , Gal Pressman , dri-devel , Linux Kernel Mailing List , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Jason Gunthorpe , Doug Ledford , Tomer Tayar , amd-gfx list , Greg KH , Alex Deucher , Leon Romanovsky , Christoph Hellwig , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Thu, Jun 24, 2021 at 10:07:14AM +0200, Christian K=F6nig wrote: > The key point is that accessing the underlying pages even when DMA-bufs a= re = > backed by system memory is illegal. Daniel even created a patch which = > mangles the page pointers in sg_tables used by DMA-buf to make sure that = > people don't try to use them. Which is another goddamn layering violation of a subsystem that has no business at all poking into the scatterlist structure, yes. > So the conclusion is that using sg_table in the DMA-buf framework was jus= t = > the wrong data structure and we should have invented a new one. I think so. > But then people would have complained that we have a duplicated = > infrastructure (which is essentially true). I doubt it. At least if you had actually talked to the relevant people. Which seems to be a major issue with what is going on GPU land. > My best plan to get out of this mess is that we change the DMA-buf = > interface to use an array of dma_addresses instead of the sg_table object = > and I have already been working on this actively the last few month. Awesome! I have a bit of related work on the DMA mapping subsystems, so let's sync up as soon as you have some first sketches. Btw, one thing I noticed when looking over the dma-buf instances is that there is a lot of duplicated code for creating a sg_table from pages, and then mapping it. It would be good if we could move toward common helpers instead of duplicating that all over again. _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx