From: Joerg Roedel <joro@8bytes.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm@lists.01.org, Sean Hefty <sean.hefty@intel.com>,
linux-xfs@vger.kernel.org, Jan Kara <jack@suse.cz>,
Ashok Raj <ashok.raj@intel.com>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
linux-rdma@vger.kernel.org, linux-api@vger.kernel.org,
Dave Chinner <david@fromorbit.com>,
Jeff Moyer <jmoyer@redhat.com>,
iommu@lists.linux-foundation.org, Christoph Hellwig <hch@lst.de>,
"J. Bruce Fields" <bfields@fieldses.org>,
linux-mm@kvack.org, Doug Ledford <dledford@redhat.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-fsdevel@vger.kernel.org,
Jeff Layton <jlayton@poochiereds.net>,
David Woodhouse <dwmw2@infradead.org>,
Hal Rosenstock <hal.rosenstock@gmail.com>
Subject: Re: [PATCH v8 13/14] IB/core: use MAP_DIRECT to fix / enable RDMA to DAX mappings
Date: Wed, 11 Oct 2017 13:54:10 +0200 [thread overview]
Message-ID: <20171011115410.GF30803@8bytes.org> (raw)
In-Reply-To: <150764701194.16882.9682569707416653741.stgit@dwillia2-desk3.amr.corp.intel.com>
On Tue, Oct 10, 2017 at 07:50:12AM -0700, Dan Williams wrote:
> +static void ib_umem_lease_break(void *__umem)
> +{
> + struct ib_umem *umem = umem;
> + struct ib_device *idev = umem->context->device;
> + struct device *dev = idev->dma_device;
> + struct scatterlist *sgl = umem->sg_head.sgl;
> +
> + iommu_unmap(umem->iommu, sg_dma_address(sgl) & PAGE_MASK,
> + iommu_sg_num_pages(dev, sgl, umem->npages));
> +}
This looks like an invitation to break your code by random iommu-driver
changes. There is no guarantee that an iommu-backed dma-api
implemenation will map exactly iommu_sg_num_pages() pages for a given
sg-list. In other words, you are mixing the use of the IOMMU-API and the
DMA-API in an incompatible way that only works because you know the
internals of the iommu-drivers.
I've seen in another patch that your changes strictly require an IOMMU,
so you what you should do instead is to switch from the DMA-API to the
IOMMU-API and do the address-space management yourself.
Regards,
Joerg
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Joerg Roedel <joro@8bytes.org>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm@lists.01.org, Sean Hefty <sean.hefty@intel.com>,
linux-xfs@vger.kernel.org, Jan Kara <jack@suse.cz>,
Ashok Raj <ashok.raj@intel.com>,
"Darrick J. Wong" <darrick.wong@oracle.com>,
linux-rdma@vger.kernel.org, linux-api@vger.kernel.org,
Dave Chinner <david@fromorbit.com>,
Jeff Moyer <jmoyer@redhat.com>,
iommu@lists.linux-foundation.org, Christoph Hellwig <hch@lst.de>,
"J. Bruce Fields" <bfields@fieldses.org>,
linux-mm@kvack.org, Doug Ledford <dledford@redhat.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-fsdevel@vger.kernel.org,
Jeff Layton <jlayton@poochiereds.net>,
David Woodhouse <dwmw2@infradead.org>,
Hal Rosenstock <hal.rosenstock@gmail.com>
Subject: Re: [PATCH v8 13/14] IB/core: use MAP_DIRECT to fix / enable RDMA to DAX mappings
Date: Wed, 11 Oct 2017 13:54:10 +0200 [thread overview]
Message-ID: <20171011115410.GF30803@8bytes.org> (raw)
In-Reply-To: <150764701194.16882.9682569707416653741.stgit@dwillia2-desk3.amr.corp.intel.com>
On Tue, Oct 10, 2017 at 07:50:12AM -0700, Dan Williams wrote:
> +static void ib_umem_lease_break(void *__umem)
> +{
> + struct ib_umem *umem = umem;
> + struct ib_device *idev = umem->context->device;
> + struct device *dev = idev->dma_device;
> + struct scatterlist *sgl = umem->sg_head.sgl;
> +
> + iommu_unmap(umem->iommu, sg_dma_address(sgl) & PAGE_MASK,
> + iommu_sg_num_pages(dev, sgl, umem->npages));
> +}
This looks like an invitation to break your code by random iommu-driver
changes. There is no guarantee that an iommu-backed dma-api
implemenation will map exactly iommu_sg_num_pages() pages for a given
sg-list. In other words, you are mixing the use of the IOMMU-API and the
DMA-API in an incompatible way that only works because you know the
internals of the iommu-drivers.
I've seen in another patch that your changes strictly require an IOMMU,
so you what you should do instead is to switch from the DMA-API to the
IOMMU-API and do the address-space management yourself.
Regards,
Joerg
next prev parent reply other threads:[~2017-10-11 11:54 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 14:48 [PATCH v8 00/14] MAP_DIRECT for DAX RDMA and userspace flush Dan Williams
2017-10-10 14:48 ` Dan Williams
2017-10-10 14:48 ` Dan Williams
2017-10-10 14:48 ` Dan Williams
[not found] ` <150764693502.16882.15848797003793552156.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-10 14:49 ` [PATCH v8 01/14] mm: introduce MAP_SHARED_VALIDATE, a mechanism to safely define new mmap flags Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
[not found] ` <150764694114.16882.5128952296874418457.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-11 7:43 ` Jan Kara
2017-10-11 7:43 ` Jan Kara
2017-10-11 7:43 ` Jan Kara
[not found] ` <20171011074320.GG3667-4I4JzKEfoa/jFM9bn6wA6Q@public.gmane.org>
2017-10-11 14:15 ` Dan Williams
2017-10-11 14:15 ` Dan Williams
2017-10-11 14:15 ` Dan Williams
2017-10-11 14:15 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 05/14] fs, xfs, iomap: introduce iomap_can_allocate() Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 06/14] xfs: wire up MAP_DIRECT Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
[not found] ` <150764697001.16882.13486539828150761233.stgit-p8uTFz9XbKj2zm6wflaqv1nYeNYlB/vhral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-10-11 1:09 ` Dave Chinner
2017-10-11 1:09 ` Dave Chinner
2017-10-11 1:09 ` Dave Chinner
2017-10-11 2:12 ` Dan Williams
2017-10-11 2:12 ` Dan Williams
2017-10-11 2:12 ` Dan Williams
2017-10-11 2:12 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 08/14] fs, mapdirect: introduce ->lease_direct() Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 09/14] xfs: wire up ->lease_direct() Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:50 ` [PATCH v8 12/14] iommu/vt-d: use iommu_num_sg_pages Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` [PATCH v8 14/14] tools/testing/nvdimm: enable rdma unit tests Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 02/14] fs, mm: pass fd to ->mmap_validate() Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 03/14] fs: MAP_DIRECT core Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 04/14] xfs: prepare xfs_break_layouts() for reuse with MAP_DIRECT Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-11 0:46 ` Dave Chinner
2017-10-11 0:46 ` Dave Chinner
2017-10-11 2:12 ` Dan Williams
2017-10-11 2:12 ` Dan Williams
2017-10-11 2:12 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 07/14] iommu, dma-mapping: introduce dma_get_iommu_domain() Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:49 ` [PATCH v8 10/14] device-dax: wire up ->lease_direct() Dan Williams
2017-10-10 14:49 ` Dan Williams
2017-10-10 14:50 ` [PATCH v8 11/14] iommu: up-level sg_num_pages() from amd-iommu Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` [PATCH v8 13/14] IB/core: use MAP_DIRECT to fix / enable RDMA to DAX mappings Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-10 14:50 ` Dan Williams
2017-10-11 11:54 ` Joerg Roedel [this message]
2017-10-11 11:54 ` Joerg Roedel
[not found] ` <20171011115410.GF30803-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2017-10-11 16:01 ` Dan Williams
2017-10-11 16:01 ` Dan Williams
2017-10-11 16:01 ` Dan Williams
2017-10-11 16:01 ` Dan Williams
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=20171011115410.GF30803@8bytes.org \
--to=joro@8bytes.org \
--cc=ashok.raj@intel.com \
--cc=bfields@fieldses.org \
--cc=dan.j.williams@intel.com \
--cc=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=dledford@redhat.com \
--cc=dwmw2@infradead.org \
--cc=hal.rosenstock@gmail.com \
--cc=hch@lst.de \
--cc=iommu@lists.linux-foundation.org \
--cc=jack@suse.cz \
--cc=jlayton@poochiereds.net \
--cc=jmoyer@redhat.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ross.zwisler@linux.intel.com \
--cc=sean.hefty@intel.com \
/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.