Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-15 Thread Dan Williams
On Sun, Oct 15, 2017 at 8:14 AM, Matan Barak wrote: [..] > IMHO, using iommu for that and causing DMA errors just because the > lease broke isn't the right thing to do. Yes, see the current proposal over in this thread: https://lists.01.org/pipermail/linux-nvdimm/2017-October/012885.html ___

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-15 Thread Matan Barak
On Fri, Oct 13, 2017 at 6:03 PM, Jason Gunthorpe wrote: > On Fri, Oct 13, 2017 at 08:50:47AM +0200, Christoph Hellwig wrote: > >> > However, chatting this over with a few more people I have an alternate >> > solution that effectively behaves the same as how non-ODP hardware >> > handles this case

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-13 Thread Jason Gunthorpe
On Fri, Oct 13, 2017 at 08:50:47AM +0200, Christoph Hellwig wrote: > > However, chatting this over with a few more people I have an alternate > > solution that effectively behaves the same as how non-ODP hardware > > handles this case of hole punch / truncation today. So, today if this > > scenari

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-13 Thread Christoph Hellwig
On Mon, Oct 09, 2017 at 01:18:20PM -0600, Jason Gunthorpe wrote: > > > If RDMA is driving this need, why not invalidate backing RDMA MRs > > > instead of requiring a IOMMU to do it? RDMA MR are finer grained and > > > do not suffer from the re-use problem David W. brought up with IOVAs.. > > > > S

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-12 Thread Christoph Hellwig
On Thu, Oct 12, 2017 at 01:10:33PM -0700, Dan Williams wrote: > On Thu, Oct 12, 2017 at 11:27 AM, Jason Gunthorpe > wrote: > > On Tue, Oct 10, 2017 at 01:17:26PM -0700, Dan Williams wrote: > > > >> Also keep in mind that what triggers the lease break is another > >> application trying to write or

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-12 Thread Dan Williams
On Thu, Oct 12, 2017 at 11:27 AM, Jason Gunthorpe wrote: > On Tue, Oct 10, 2017 at 01:17:26PM -0700, Dan Williams wrote: > >> Also keep in mind that what triggers the lease break is another >> application trying to write or punch holes in a file that is mapped >> for RDMA. So, if the hardware can'

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-12 Thread Jason Gunthorpe
On Tue, Oct 10, 2017 at 01:17:26PM -0700, Dan Williams wrote: > Also keep in mind that what triggers the lease break is another > application trying to write or punch holes in a file that is mapped > for RDMA. So, if the hardware can't handle the iommu mapping getting > invalidated asynchronously

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-10 Thread Dan Williams
On Tue, Oct 10, 2017 at 11:05 AM, Jason Gunthorpe wrote: > On Tue, Oct 10, 2017 at 10:39:27AM -0700, Dan Williams wrote: >> On Tue, Oct 10, 2017 at 10:25 AM, Jason Gunthorpe > >> >> Have a look at the patch [1], I don't touch the ODP path. >> > >> > But, does ODP work OK already? I'm not clear on

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-10 Thread Jason Gunthorpe
On Tue, Oct 10, 2017 at 10:39:27AM -0700, Dan Williams wrote: > On Tue, Oct 10, 2017 at 10:25 AM, Jason Gunthorpe > >> Have a look at the patch [1], I don't touch the ODP path. > > > > But, does ODP work OK already? I'm not clear on that.. > > It had better. If the mapping is invalidated I would

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-10 Thread Dan Williams
On Tue, Oct 10, 2017 at 10:25 AM, Jason Gunthorpe wrote: > On Mon, Oct 09, 2017 at 12:28:29PM -0700, Dan Williams wrote: > >> > I don't think this has ever come up in the context of an all-device MR >> > invalidate requirement. Drivers already have code to invalidate >> > specifc MRs, but to find

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-10 Thread Jason Gunthorpe
On Mon, Oct 09, 2017 at 12:28:29PM -0700, Dan Williams wrote: > > I don't think this has ever come up in the context of an all-device MR > > invalidate requirement. Drivers already have code to invalidate > > specifc MRs, but to find all MRs that touch certain pages and then > > invalidate them wo

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-09 Thread Dan Williams
On Mon, Oct 9, 2017 at 12:18 PM, Jason Gunthorpe wrote: > On Mon, Oct 09, 2017 at 12:05:30PM -0700, Dan Williams wrote: >> On Mon, Oct 9, 2017 at 11:58 AM, Jason Gunthorpe >> wrote: >> > On Fri, Oct 06, 2017 at 03:35:54PM -0700, Dan Williams wrote: >> >> otherwise be quiesced. The need for this k

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-09 Thread Jason Gunthorpe
On Mon, Oct 09, 2017 at 12:05:30PM -0700, Dan Williams wrote: > On Mon, Oct 9, 2017 at 11:58 AM, Jason Gunthorpe > wrote: > > On Fri, Oct 06, 2017 at 03:35:54PM -0700, Dan Williams wrote: > >> otherwise be quiesced. The need for this knowledge is driven by a need > >> to make RDMA transfers to DAX

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-09 Thread Dan Williams
On Mon, Oct 9, 2017 at 11:58 AM, Jason Gunthorpe wrote: > On Fri, Oct 06, 2017 at 03:35:54PM -0700, Dan Williams wrote: >> otherwise be quiesced. The need for this knowledge is driven by a need >> to make RDMA transfers to DAX mappings safe. If the DAX file's block map >> changes we need to be to

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-09 Thread Jason Gunthorpe
On Fri, Oct 06, 2017 at 03:35:54PM -0700, Dan Williams wrote: > otherwise be quiesced. The need for this knowledge is driven by a need > to make RDMA transfers to DAX mappings safe. If the DAX file's block map > changes we need to be to reliably stop accesses to blocks that have been > freed or re-

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-07 Thread Dan Williams
On Sat, Oct 7, 2017 at 4:08 AM, David Woodhouse wrote: > On Fri, 2017-10-06 at 16:15 -0700, Dan Williams wrote: >> >> Right, crossed mails. The semantic I want is that the IOVA is >> invalidated / starts throwing errors to the device because the address >> it thought it was talking to has been rem

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-06 Thread Dan Williams
On Fri, Oct 6, 2017 at 4:10 PM, David Woodhouse wrote: > On Fri, 2017-10-06 at 15:52 -0700, Dan Williams wrote: >> On Fri, Oct 6, 2017 at 3:45 PM, David Woodhouse wrote: >> > >> > On Fri, 2017-10-06 at 15:35 -0700, Dan Williams wrote: >> > > >> > > Add a helper to determine if the dma mappings se

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-06 Thread Dan Williams
On Fri, Oct 6, 2017 at 3:52 PM, Dan Williams wrote: > On Fri, Oct 6, 2017 at 3:45 PM, David Woodhouse wrote: >> On Fri, 2017-10-06 at 15:35 -0700, Dan Williams wrote: >>> Add a helper to determine if the dma mappings set up for a given device >>> are backed by an iommu. In particular, this lets c

Re: [PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-06 Thread Dan Williams
On Fri, Oct 6, 2017 at 3:45 PM, David Woodhouse wrote: > On Fri, 2017-10-06 at 15:35 -0700, Dan Williams wrote: >> Add a helper to determine if the dma mappings set up for a given device >> are backed by an iommu. In particular, this lets code paths know that a >> dma_unmap operation will revoke a

[PATCH v7 07/12] dma-mapping: introduce dma_has_iommu()

2017-10-06 Thread Dan Williams
Add a helper to determine if the dma mappings set up for a given device are backed by an iommu. In particular, this lets code paths know that a dma_unmap operation will revoke access to memory if the device can not otherwise be quiesced. The need for this knowledge is driven by a need to make RDMA