All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "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>,
	"Christoph Hellwig" <hch@lst.de>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Christian König" <christian.koenig@amd.com>,
	"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: Tue, 22 Jun 2021 12:34:22 -0300	[thread overview]
Message-ID: <20210622153422.GR1096940@ziepe.ca> (raw)
In-Reply-To: <CAFCwf1361iVGeGtcc8WsQeFmHMWY+J6UNkzJnrodFrsOh9zgqQ@mail.gmail.com>

On Tue, Jun 22, 2021 at 06:24:28PM +0300, Oded Gabbay wrote:
> On Tue, Jun 22, 2021 at 6:11 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > On Tue, Jun 22, 2021 at 04:12:26PM +0300, Oded Gabbay wrote:
> >
> > > > 1) Setting sg_page to NULL
> > > > 2) 'mapping' pages for P2P DMA without going through the iommu
> > > > 3) Allowing P2P DMA without using the p2p dma API to validate that it
> > > >    can work at all in the first place.
> > > >
> > > > All of these result in functional bugs in certain system
> > > > configurations.
> > > >
> > > > Jason
> > >
> > > Hi Jason,
> > > Thanks for the feedback.
> > > Regarding point 1, why is that a problem if we disable the option to
> > > mmap the dma-buf from user-space ?
> >
> > Userspace has nothing to do with needing struct pages or not
> >
> > Point 1 and 2 mostly go together, you supporting the iommu is not nice
> > if you dont have struct pages.
> >
> > You should study Logan's patches I pointed you at as they are solving
> > exactly this problem.

> Yes, I do need to study them. I agree with you here. It appears I
> have a hole in my understanding.  I'm missing the connection between
> iommu support (which I must have of course) and struct pages.

Chistian explained what the AMD driver is doing by calling
dma_map_resource().

Which is a hacky and slow way of achieving what Logan's series is
doing.

> > No, the design of the dmabuf requires the exporter to do the dma maps
> > and so it is only the exporter that is wrong to omit all the iommu and
> > p2p logic.
> >
> > RDMA is OK today only because nobody has implemented dma buf support
> > in rxe/si - mainly because the only implementations of exporters don't
>
> Can you please educate me, what is rxe/si ?

Sorry, rxe/siw - these are the all-software implementations of RDMA
and they require the struct page to do a SW memory copy. They can't
implement dmabuf without it.

> ok...
> so how come that patch-set was merged into 5.12 if it's buggy ?

We only implemented true dma devices for RDMA DMABUF support, so it is
isn't buggy right now.

> Yes, that's what I expect to see. But I want to see it with my own
> eyes and then figure out how to solve this.

It might be tricky to test because you have to ensure the iommu is
turned on and has a non-idenity page table. Basically if it doesn't
trigger a IOMMU failure then the IOMMU isn't setup properly.

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "Christian König" <christian.koenig@amd.com>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	sleybo@amazon.com, "Gal Pressman" <galpress@amazon.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"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>,
	"Oded Gabbay" <ogabbay@kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"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: Tue, 22 Jun 2021 12:34:22 -0300	[thread overview]
Message-ID: <20210622153422.GR1096940@ziepe.ca> (raw)
In-Reply-To: <CAFCwf1361iVGeGtcc8WsQeFmHMWY+J6UNkzJnrodFrsOh9zgqQ@mail.gmail.com>

On Tue, Jun 22, 2021 at 06:24:28PM +0300, Oded Gabbay wrote:
> On Tue, Jun 22, 2021 at 6:11 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > On Tue, Jun 22, 2021 at 04:12:26PM +0300, Oded Gabbay wrote:
> >
> > > > 1) Setting sg_page to NULL
> > > > 2) 'mapping' pages for P2P DMA without going through the iommu
> > > > 3) Allowing P2P DMA without using the p2p dma API to validate that it
> > > >    can work at all in the first place.
> > > >
> > > > All of these result in functional bugs in certain system
> > > > configurations.
> > > >
> > > > Jason
> > >
> > > Hi Jason,
> > > Thanks for the feedback.
> > > Regarding point 1, why is that a problem if we disable the option to
> > > mmap the dma-buf from user-space ?
> >
> > Userspace has nothing to do with needing struct pages or not
> >
> > Point 1 and 2 mostly go together, you supporting the iommu is not nice
> > if you dont have struct pages.
> >
> > You should study Logan's patches I pointed you at as they are solving
> > exactly this problem.

> Yes, I do need to study them. I agree with you here. It appears I
> have a hole in my understanding.  I'm missing the connection between
> iommu support (which I must have of course) and struct pages.

Chistian explained what the AMD driver is doing by calling
dma_map_resource().

Which is a hacky and slow way of achieving what Logan's series is
doing.

> > No, the design of the dmabuf requires the exporter to do the dma maps
> > and so it is only the exporter that is wrong to omit all the iommu and
> > p2p logic.
> >
> > RDMA is OK today only because nobody has implemented dma buf support
> > in rxe/si - mainly because the only implementations of exporters don't
>
> Can you please educate me, what is rxe/si ?

Sorry, rxe/siw - these are the all-software implementations of RDMA
and they require the struct page to do a SW memory copy. They can't
implement dmabuf without it.

> ok...
> so how come that patch-set was merged into 5.12 if it's buggy ?

We only implemented true dma devices for RDMA DMABUF support, so it is
isn't buggy right now.

> Yes, that's what I expect to see. But I want to see it with my own
> eyes and then figure out how to solve this.

It might be tricky to test because you have to ensure the iommu is
turned on and has a non-idenity page table. Basically if it doesn't
trigger a IOMMU failure then the IOMMU isn't setup properly.

Jason

WARNING: multiple messages have this Message-ID (diff)
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Oded Gabbay <oded.gabbay@gmail.com>
Cc: "Christian König" <christian.koenig@amd.com>,
	linux-rdma <linux-rdma@vger.kernel.org>,
	"Christian König" <ckoenig.leichtzumerken@gmail.com>,
	sleybo@amazon.com, "Gal Pressman" <galpress@amazon.com>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	"Christoph Hellwig" <hch@lst.de>,
	"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>,
	"Oded Gabbay" <ogabbay@kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"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: Tue, 22 Jun 2021 12:34:22 -0300	[thread overview]
Message-ID: <20210622153422.GR1096940@ziepe.ca> (raw)
In-Reply-To: <CAFCwf1361iVGeGtcc8WsQeFmHMWY+J6UNkzJnrodFrsOh9zgqQ@mail.gmail.com>

On Tue, Jun 22, 2021 at 06:24:28PM +0300, Oded Gabbay wrote:
> On Tue, Jun 22, 2021 at 6:11 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > On Tue, Jun 22, 2021 at 04:12:26PM +0300, Oded Gabbay wrote:
> >
> > > > 1) Setting sg_page to NULL
> > > > 2) 'mapping' pages for P2P DMA without going through the iommu
> > > > 3) Allowing P2P DMA without using the p2p dma API to validate that it
> > > >    can work at all in the first place.
> > > >
> > > > All of these result in functional bugs in certain system
> > > > configurations.
> > > >
> > > > Jason
> > >
> > > Hi Jason,
> > > Thanks for the feedback.
> > > Regarding point 1, why is that a problem if we disable the option to
> > > mmap the dma-buf from user-space ?
> >
> > Userspace has nothing to do with needing struct pages or not
> >
> > Point 1 and 2 mostly go together, you supporting the iommu is not nice
> > if you dont have struct pages.
> >
> > You should study Logan's patches I pointed you at as they are solving
> > exactly this problem.

> Yes, I do need to study them. I agree with you here. It appears I
> have a hole in my understanding.  I'm missing the connection between
> iommu support (which I must have of course) and struct pages.

Chistian explained what the AMD driver is doing by calling
dma_map_resource().

Which is a hacky and slow way of achieving what Logan's series is
doing.

> > No, the design of the dmabuf requires the exporter to do the dma maps
> > and so it is only the exporter that is wrong to omit all the iommu and
> > p2p logic.
> >
> > RDMA is OK today only because nobody has implemented dma buf support
> > in rxe/si - mainly because the only implementations of exporters don't
>
> Can you please educate me, what is rxe/si ?

Sorry, rxe/siw - these are the all-software implementations of RDMA
and they require the struct page to do a SW memory copy. They can't
implement dmabuf without it.

> ok...
> so how come that patch-set was merged into 5.12 if it's buggy ?

We only implemented true dma devices for RDMA DMABUF support, so it is
isn't buggy right now.

> Yes, that's what I expect to see. But I want to see it with my own
> eyes and then figure out how to solve this.

It might be tricky to test because you have to ensure the iommu is
turned on and has a non-idenity page table. Basically if it doesn't
trigger a IOMMU failure then the IOMMU isn't setup properly.

Jason
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

  reply	other threads:[~2021-06-22 15:34 UTC|newest]

Thread overview: 143+ 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 ` Oded Gabbay
2021-06-18 12:36 ` [PATCH v3 2/2] habanalabs: add support for dma-buf exporter Oded Gabbay
2021-06-18 12:36   ` 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 12:28   ` Daniel Vetter
2021-06-21 12:28   ` Daniel Vetter
2021-06-21 13:02   ` Greg KH
2021-06-21 13:02     ` Greg KH
2021-06-21 13:02     ` Greg KH
2021-06-21 14:12     ` Jason Gunthorpe
2021-06-21 14:12       ` Jason Gunthorpe
2021-06-21 14:12       ` Jason Gunthorpe
2021-06-21 16:26       ` Oded Gabbay
2021-06-21 16:26         ` Oded Gabbay
2021-06-21 16:26         ` Oded Gabbay
2021-06-21 17:55         ` Jason Gunthorpe
2021-06-21 17:55           ` Jason Gunthorpe
2021-06-21 17:55           ` Jason Gunthorpe
2021-06-21 18:27           ` Daniel Vetter
2021-06-21 18:27             ` Daniel Vetter
2021-06-21 18:27             ` Daniel Vetter
2021-06-21 19:24             ` Oded Gabbay
2021-06-21 19:24               ` Oded Gabbay
2021-06-21 19:24               ` Oded Gabbay
2021-06-21 23:29               ` Jason Gunthorpe
2021-06-21 23:29                 ` Jason Gunthorpe
2021-06-21 23:29                 ` Jason Gunthorpe
2021-06-22  6:37                 ` [Linaro-mm-sig] " Christian König
2021-06-22  6:37                   ` Christian König
2021-06-22  6:37                   ` Christian König
2021-06-22  8:42                   ` Oded Gabbay
2021-06-22  8:42                     ` Oded Gabbay
2021-06-22  8:42                     ` Oded Gabbay
2021-06-22 12:01                     ` Jason Gunthorpe
2021-06-22 12:01                       ` Jason Gunthorpe
2021-06-22 12:01                       ` Jason Gunthorpe
2021-06-22 12:04                       ` Oded Gabbay
2021-06-22 12:04                         ` Oded Gabbay
2021-06-22 12:04                         ` Oded Gabbay
2021-06-22 12:15                         ` Jason Gunthorpe
2021-06-22 12:15                           ` Jason Gunthorpe
2021-06-22 12:15                           ` Jason Gunthorpe
2021-06-22 13:12                           ` Oded Gabbay
2021-06-22 13:12                             ` Oded Gabbay
2021-06-22 13:12                             ` Oded Gabbay
2021-06-22 15:11                             ` Jason Gunthorpe
2021-06-22 15:11                               ` Jason Gunthorpe
2021-06-22 15:11                               ` Jason Gunthorpe
2021-06-22 15:24                               ` Christian König
2021-06-22 15:24                                 ` Christian König
2021-06-22 15:24                                 ` Christian König
2021-06-22 15:28                                 ` Jason Gunthorpe
2021-06-22 15:28                                   ` Jason Gunthorpe
2021-06-22 15:28                                   ` Jason Gunthorpe
2021-06-22 15:31                                   ` Oded Gabbay
2021-06-22 15:31                                     ` Oded Gabbay
2021-06-22 15:31                                     ` Oded Gabbay
2021-06-22 15:31                                   ` Christian König
2021-06-22 15:31                                     ` Christian König
2021-06-22 15:31                                     ` Christian König
2021-06-22 15:40                                     ` Oded Gabbay
2021-06-22 15:40                                       ` Oded Gabbay
2021-06-22 15:40                                       ` Oded Gabbay
2021-06-22 15:49                                       ` Christian König
2021-06-22 15:49                                         ` Christian König
2021-06-22 15:49                                         ` Christian König
2021-06-22 15:24                               ` Oded Gabbay
2021-06-22 15:24                                 ` Oded Gabbay
2021-06-22 15:24                                 ` Oded Gabbay
2021-06-22 15:34                                 ` Jason Gunthorpe [this message]
2021-06-22 15:34                                   ` Jason Gunthorpe
2021-06-22 15:34                                   ` Jason Gunthorpe
2021-06-22 12:23                       ` Christian König
2021-06-22 12:23                         ` Christian König
2021-06-22 12:23                         ` Christian König
2021-06-22 15:23                         ` Jason Gunthorpe
2021-06-22 15:23                           ` Jason Gunthorpe
2021-06-22 15:23                           ` Jason Gunthorpe
2021-06-22 15:29                           ` Christian König
2021-06-22 15:29                             ` Christian König
2021-06-22 15:29                             ` Christian König
2021-06-22 15:40                             ` Jason Gunthorpe
2021-06-22 15:40                               ` Jason Gunthorpe
2021-06-22 15:40                               ` Jason Gunthorpe
2021-06-22 15:48                               ` Christian König
2021-06-22 15:48                                 ` Christian König
2021-06-22 15:48                                 ` Christian König
2021-06-22 16:05                                 ` Jason Gunthorpe
2021-06-22 16:05                                   ` Jason Gunthorpe
2021-06-22 16:05                                   ` Jason Gunthorpe
2021-06-23  8:57                                   ` Christian König
2021-06-23  8:57                                     ` Christian König
2021-06-23  8:57                                     ` Christian König
2021-06-23  9:14                                     ` Oded Gabbay
2021-06-23  9:14                                       ` Oded Gabbay
2021-06-23  9:14                                       ` Oded Gabbay
2021-06-23 18:24                                     ` Jason Gunthorpe
2021-06-23 18:24                                       ` Jason Gunthorpe
2021-06-23 18:24                                       ` Jason Gunthorpe
2021-06-23 18:43                                       ` Oded Gabbay
2021-06-23 18:43                                         ` Oded Gabbay
2021-06-23 18:43                                         ` Oded Gabbay
2021-06-23 18:50                                         ` Jason Gunthorpe
2021-06-23 18:50                                           ` Jason Gunthorpe
2021-06-23 18:50                                           ` Jason Gunthorpe
2021-06-23 19:00                                           ` Oded Gabbay
2021-06-23 19:00                                             ` Oded Gabbay
2021-06-23 19:00                                             ` Oded Gabbay
2021-06-23 19:34                                             ` Jason Gunthorpe
2021-06-23 19:34                                               ` Jason Gunthorpe
2021-06-23 19:34                                               ` Jason Gunthorpe
2021-06-23 19:39                                               ` Oded Gabbay
2021-06-23 19:39                                                 ` Oded Gabbay
2021-06-23 19:39                                                 ` Oded Gabbay
2021-06-24  0:45                                                 ` Jason Gunthorpe
2021-06-24  0:45                                                   ` Jason Gunthorpe
2021-06-24  0:45                                                   ` Jason Gunthorpe
2021-06-24  5:40                                                 ` Christoph Hellwig
2021-06-24  5:40                                                   ` Christoph Hellwig
2021-06-24  5:34                                             ` Christoph Hellwig
2021-06-24  5:34                                               ` Christoph Hellwig
2021-06-24  8:07                                               ` Christian König
2021-06-24  8:07                                                 ` Christian König
2021-06-24  8:07                                                 ` Christian König
2021-06-24  8:12                                                 ` Christoph Hellwig
2021-06-24  8:12                                                   ` Christoph Hellwig
2021-06-24  9:52                                                   ` Christian König
2021-06-24  9:52                                                     ` Christian König
2021-06-24  9:52                                                     ` Christian König
2021-06-24 13:22                                                     ` Christoph Hellwig
2021-06-24 13:22                                                       ` Christoph Hellwig
2021-06-22 16:50                             ` Felix Kuehling
2021-06-22 16:50                               ` Felix Kuehling
2021-06-22 16:50                               ` Felix Kuehling
2021-06-21 14:20     ` Daniel Vetter
2021-06-21 14:20       ` Daniel Vetter
2021-06-21 14:20       ` Daniel Vetter
2021-06-21 14:49       ` Jason Gunthorpe
2021-06-21 14:49         ` Jason Gunthorpe
2021-06-21 14:17   ` Jason Gunthorpe
2021-06-21 14:17     ` 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=20210622153422.GR1096940@ziepe.ca \
    --to=jgg@ziepe.ca \
    --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=hch@lst.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.