linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Christoph Hellwig" <hch@lst.de>,
	"Oded Gabbay" <oded.gabbay@gmail.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	"Gal Pressman" <galpress@amazon.com>,
	sleybo@amazon.com, linux-rdma <linux-rdma@vger.kernel.org>,
	"Oded Gabbay" <ogabbay@kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"moderated list:DMA BUFFER SHARING FRAMEWORK"
	<linaro-mm-sig@lists.linaro.org>,
	"Doug Ledford" <dledford@redhat.com>,
	"Tomer Tayar" <ttayar@habana.ai>,
	"amd-gfx list" <amd-gfx@lists.freedesktop.org>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Leon Romanovsky" <leonro@nvidia.com>,
	"open list:DMA BUFFER SHARING FRAMEWORK"
	<linux-media@vger.kernel.org>
Subject: Re: [Linaro-mm-sig] [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF
Date: Thu, 24 Jun 2021 10:12:37 +0200	[thread overview]
Message-ID: <20210624081237.GA30289@lst.de> (raw)
In-Reply-To: <9571ac7c-3a58-b013-b849-e26c3727e9b2@amd.com>

On Thu, Jun 24, 2021 at 10:07:14AM +0200, Christian König wrote:
> The key point is that accessing the underlying pages even when DMA-bufs are 
> 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 just 
> 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.

  reply	other threads:[~2021-06-24  8:12 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-18 12:36 [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF Oded Gabbay
2021-06-18 12:36 ` [PATCH v3 2/2] habanalabs: add support for dma-buf exporter Oded Gabbay
2021-06-21 12:28 ` [PATCH v3 1/2] habanalabs: define uAPI to export FD for DMA-BUF Daniel Vetter
2021-06-21 13:02   ` Greg KH
2021-06-21 14:12     ` Jason Gunthorpe
2021-06-21 16:26       ` Oded Gabbay
2021-06-21 17:55         ` Jason Gunthorpe
2021-06-21 18:27           ` Daniel Vetter
2021-06-21 19:24             ` Oded Gabbay
2021-06-21 23:29               ` Jason Gunthorpe
2021-06-22  6:37                 ` [Linaro-mm-sig] " Christian König
2021-06-22  8:42                   ` Oded Gabbay
2021-06-22 12:01                     ` Jason Gunthorpe
2021-06-22 12:04                       ` Oded Gabbay
2021-06-22 12:15                         ` Jason Gunthorpe
2021-06-22 13:12                           ` Oded Gabbay
2021-06-22 15:11                             ` Jason Gunthorpe
2021-06-22 15:24                               ` Christian König
2021-06-22 15:28                                 ` Jason Gunthorpe
2021-06-22 15:31                                   ` Oded Gabbay
2021-06-22 15:31                                   ` Christian König
2021-06-22 15:40                                     ` Oded Gabbay
2021-06-22 15:49                                       ` Christian König
2021-06-22 15:24                               ` Oded Gabbay
2021-06-22 15:34                                 ` Jason Gunthorpe
2021-06-22 12:23                       ` Christian König
2021-06-22 15:23                         ` Jason Gunthorpe
2021-06-22 15:29                           ` Christian König
2021-06-22 15:40                             ` Jason Gunthorpe
2021-06-22 15:48                               ` Christian König
2021-06-22 16:05                                 ` Jason Gunthorpe
2021-06-23  8:57                                   ` Christian König
2021-06-23  9:14                                     ` Oded Gabbay
2021-06-23 18:24                                     ` Jason Gunthorpe
2021-06-23 18:43                                       ` Oded Gabbay
2021-06-23 18:50                                         ` Jason Gunthorpe
2021-06-23 19:00                                           ` Oded Gabbay
2021-06-23 19:34                                             ` Jason Gunthorpe
2021-06-23 19:39                                               ` Oded Gabbay
2021-06-24  0:45                                                 ` Jason Gunthorpe
2021-06-24  5:40                                                 ` Christoph Hellwig
2021-06-24  5:34                                             ` Christoph Hellwig
2021-06-24  8:07                                               ` Christian König
2021-06-24  8:12                                                 ` Christoph Hellwig [this message]
2021-06-24  9:52                                                   ` Christian König
2021-06-24 13:22                                                     ` Christoph Hellwig
2021-06-22 16:50                             ` Felix Kuehling
2021-06-21 14:20     ` Daniel Vetter
2021-06-21 14:49       ` Jason Gunthorpe
2021-06-21 14:17   ` Jason Gunthorpe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210624081237.GA30289@lst.de \
    --to=hch@lst.de \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=christian.koenig@amd.com \
    --cc=ckoenig.leichtzumerken@gmail.com \
    --cc=dledford@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=galpress@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgg@ziepe.ca \
    --cc=leonro@nvidia.com \
    --cc=linaro-mm-sig@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=oded.gabbay@gmail.com \
    --cc=ogabbay@kernel.org \
    --cc=sleybo@amazon.com \
    --cc=ttayar@habana.ai \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).