Re: [PATCH v2 1/5] PCI/P2PDMA: Don't enforce ACS check for functions of same device

2024-10-30 Thread Logan Gunthorpe
On 2024-10-30 12:46, Bjorn Helgaas wrote: > On Fri, Oct 25, 2024 at 06:57:37AM +, Kasireddy, Vivek wrote: > In the PCIe world, I don't think a TLP can "loop back" to another > function on the same device. I'm not sure if the spec says anything that specifically denies this. But it seems to

Re: [PATCH v2 1/5] PCI/P2PDMA: Don't enforce ACS check for functions of same device

2024-10-24 Thread Logan Gunthorpe
On 2024-10-23 23:50, Kasireddy, Vivek wrote: >> I'd echo many of Bjorn's concerns. In addition, I think the name of the >> pci_devs_are_p2pdma_compatible() isn't quite right. Specifically this is >> dealing with PCI functions within a single device that are known to >> allow P2P traffic. So I th

Re: [PATCH v2 1/5] PCI/P2PDMA: Don't enforce ACS check for functions of same device

2024-10-22 Thread Logan Gunthorpe
Intel GPU functions >> as they are P2PDMA compatible given the way the PF provisions >> the resources among multiple VFs. > > I don't want version history in the commit log. If the content is > useful, just incorporate it here directly (without the version info), &

Re: [PATCH v1 1/5] PCI/P2PDMA: Don't enforce ACS check for functions of same device

2024-10-16 Thread Logan Gunthorpe
On 2024-10-15 23:29, Kasireddy, Vivek wrote: > I think it would make sense to limit the passing criteria for device > functions' > compatibility to Intel GPUs for now. These are the devices I am currently > testing that we know are P2P compatible. Would this be OK? Yes, this sounds good to me.

Re: [PATCH v1 1/5] PCI/P2PDMA: Don't enforce ACS check for functions of same device

2024-10-15 Thread Logan Gunthorpe
On 2024-10-11 20:40, Vivek Kasireddy wrote: > Functions of the same PCI device (such as a PF and a VF) share the > same bus and have a common root port and typically, the PF provisions > resources for the VF. Therefore, they can be considered compatible > as far as P2P access is considered. > >

Re: [PATCH 02/12] pci/p2pdma: Don't initialise page refcount to one

2024-09-10 Thread Logan Gunthorpe
On 2024-09-09 22:14, Alistair Popple wrote: > The reference counts for ZONE_DEVICE private pages should be > initialised by the driver when the page is actually allocated by the > driver allocator, not when they are first created. This is currently > the case for MEMORY_DEVICE_PRIVATE and MEMORY

Re: [PATCH 02/12] pci/p2pdma: Don't initialise page refcount to one

2024-09-10 Thread Logan Gunthorpe
On 2024-09-09 22:14, Alistair Popple wrote: > The reference counts for ZONE_DEVICE private pages should be > initialised by the driver when the page is actually allocated by the > driver allocator, not when they are first created. This is currently > the case for MEMORY_DEVICE_PRIVATE and MEMORY

Bug#1071590: linux-image-6.1.0-21-amd64: Kernel werning in unmap_page_range()

2024-05-21 Thread Logan Gunthorpe
Package: src:linux Version: 6.1.90-1 Severity: normal Dear Maintainer, I recently upgraded a machine from bullseye to bookworm. While this was successful, I started noticing a kernel warning a few hours after every boot. The kernel warning happens only once per-boot. Seems to be an issue

Bug#1071590: linux-image-6.1.0-21-amd64: Kernel werning in unmap_page_range()

2024-05-21 Thread Logan Gunthorpe
Package: src:linux Version: 6.1.90-1 Severity: normal Dear Maintainer, I recently upgraded a machine from bullseye to bookworm. While this was successful, I started noticing a kernel warning a few hours after every boot. The kernel warning happens only once per-boot. Seems to be an issue

Re: [RFC 03/10] pci/p2pdma: Don't initialise page refcount to one

2024-05-09 Thread Logan Gunthorpe
Hi Alistair, I was working on testing your patch set, however I'm dealing with some hardware issues at the moment so I haven't fully tested everything yet. I managed to find one issue though: On 2024-04-10 18:57, Alistair Popple wrote: > diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c >

Bug#1015871: Enabling PCI_P2PDMA for distro kernels?

2023-10-25 Thread Logan Gunthorpe
On 2023-10-25 11:35, Bjorn Helgaas wrote: > On Wed, Oct 25, 2023 at 07:11:26PM +0200, Lukas Wunner wrote: >> On Wed, Oct 25, 2023 at 10:30:07AM -0600, Logan Gunthorpe wrote: >>> In addition to the above, P2PDMA transfers are only allowed by the >>> kernel for traffic

Bug#1015871: Enabling PCI_P2PDMA for distro kernels?

2023-10-25 Thread Logan Gunthorpe
On 2023-10-25 11:35, Bjorn Helgaas wrote: > On Wed, Oct 25, 2023 at 07:11:26PM +0200, Lukas Wunner wrote: >> On Wed, Oct 25, 2023 at 10:30:07AM -0600, Logan Gunthorpe wrote: >>> In addition to the above, P2PDMA transfers are only allowed by the >>> kernel for traffic

Bug#1015871: Enabling PCI_P2PDMA for distro kernels?

2023-10-25 Thread Logan Gunthorpe
On 2023-10-25 00:19, Uwe Kleine-König wrote: > Hello, > > in https://bugs.debian.org/1015871 the Debian kernel team got a request > to enable PCI_P2PDMA. Given the description of the feature and also the > "If unsure, say N." I wonder if you consider it safe to enable this > option. I don't kn

Bug#1015871: Enabling PCI_P2PDMA for distro kernels?

2023-10-25 Thread Logan Gunthorpe
On 2023-10-25 00:19, Uwe Kleine-König wrote: > Hello, > > in https://bugs.debian.org/1015871 the Debian kernel team got a request > to enable PCI_P2PDMA. Given the description of the feature and also the > "If unsure, say N." I wonder if you consider it safe to enable this > option. I don't kn

[OE-core] [PATCH RESEND] runqemu: Add squashfs filesystem types

2023-10-19 Thread Logan Gunthorpe via lists.openembedded.org
When using a squashfs filesystem type, runqemu requires specifying the full path to the image because it doesn't list squashfs types in its fstypes variable. Add them to provide the same support as other filesystem types. Signed-off-by: Logan Gunthorpe --- scripts/runqemu | 4 +++- 1

Re: [OE-core] [PATCH] runqemu: Add squashfs filesystem types

2023-10-19 Thread Logan Gunthorpe via lists.openembedded.org
On 2023-10-19 14:57, Alexandre Belloni wrote: > Hello, > > On 19/10/2023 12:10:51-0600, Logan Gunthorpe via lists.openembedded.org wrote: >> From: Logan Gunthorpe >> >> When using a squashfs filesystem type, runqemu requires specifying the >> full path to

[OE-core] [PATCH] runqemu: Add squashfs filesystem types

2023-10-19 Thread Logan Gunthorpe via lists.openembedded.org
From: Logan Gunthorpe When using a squashfs filesystem type, runqemu requires specifying the full path to the image because it doesn't list squashfs types in its fstypes variable. Add them to provide the same support as other filesystem types. Signed-off-by: Logan Gunthorpe --- sc

Re: [PATCH][next] PCI/P2PDMA: Fix undefined behavior bug in struct pci_p2pdma_pagemap

2023-10-02 Thread Logan Gunthorpe
On 2023-10-02 12:40, Gustavo A. R. Silva wrote: > > > On 10/2/23 18:07, Logan Gunthorpe wrote: >> >> >> On 2023-10-01 15:08, Gustavo A. R. Silva wrote: >>> `struct dev_pagemap` is a flexible structure, which means that it >>> contains a fl

Re: [PATCH][next] PCI/P2PDMA: Fix undefined behavior bug in struct pci_p2pdma_pagemap

2023-10-02 Thread Logan Gunthorpe
ce); so there is no way to actually hit any bug with the current code. I totally agree that the patch should be applied to prevent possible bugs being introduced in the future: Reviewed-by: Logan Gunthorpe Logan

Re: [dm-devel] [PATCH -next v6 5/5] md: protect md_thread with rcu

2023-04-13 Thread Logan Gunthorpe
On 2023-04-13 05:32, Yu Kuai wrote: > From: Yu Kuai > > Our test reports a uaf for 'mddev->sync_thread': > > T1 T2 > md_start_sync > md_register_thread > // mddev->sync_thread is set > raid1d >md_check_recovery >

[PATCH v8 00/13] DMA Mapping P2PDMA Pages

2022-07-09 Thread Logan Gunthorpe
ted Acks and Reviews by Bjorn, Jason and Max. -- Logan Gunthorpe (13): lib/scatterlist: add flag for indicating P2PDMA segments in an SGL PCI/P2PDMA: Attempt to set map_type if it has not been set PCI/P2PDMA: Introduce helpers for dma_map_sg implementations dma-mapping: allow EREMOTEIO re

[PATCH v8 08/13] iommu/dma: support PCI P2PDMA pages in dma-iommu map_sg

2022-07-09 Thread Logan Gunthorpe
dress segments. On unmap, P2PDMA segments are skipped over when determining the start and end IOVA addresses. With this change, the flags variable in the dma_map_ops is set to DMA_F_PCI_P2PDMA_SUPPORTED to indicate support for P2PDMA pages. Signed-off-by: Logan Gunthorpe --- drivers/iommu/dma-io

[PATCH v8 03/13] PCI/P2PDMA: Introduce helpers for dma_map_sg implementations

2022-07-09 Thread Logan Gunthorpe
-ops.h as it is only useful to dma map implementations and don't need to pollute the public pci-p2pdma header. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Christoph Hellwig --- drivers/pci/p2pdma.c| 44 +- include/linux/dma-map-ops.h

[PATCH v8 06/13] dma-mapping: add flags to dma_map_ops to indicate PCI P2PDMA support

2022-07-09 Thread Logan Gunthorpe
Add a flags member to the dma_map_ops structure with one flag to indicate support for PCI P2PDMA. Also, add a helper to check if a device supports PCI P2PDMA. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig --- include/linux/dma-map-ops.h | 10

[PATCH v8 04/13] dma-mapping: allow EREMOTEIO return code for P2PDMA transfers

2022-07-09 Thread Logan Gunthorpe
Add EREMOTEIO error return to dma_map_sgtable() which will be used by .map_sg() implementations that detect P2PDMA pages that the underlying DMA device cannot access. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig --- kernel/dma/mapping.c | 5

[PATCH v8 10/13] nvme-pci: convert to using dma_map_sgtable()

2022-07-09 Thread Logan Gunthorpe
P2PDMA transfer is requested. When this happens, return BLK_STS_TARGET so the request isn't retried. Signed-off-by: Logan Gunthorpe Reviewed-by: Max Gurtovoy Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig --- drivers/nvme/host/pci.c

[PATCH v8 05/13] dma-direct: support PCI P2PDMA pages in dma-direct map_sg

2022-07-09 Thread Logan Gunthorpe
thus the mapping operation should fail (and it will return -EREMOTEIO). SGL segments that contain PCI bus addresses are marked with sg_dma_mark_pci_p2pdma() and are ignored when unmapped. P2PDMA mappings are also failed if swiotlb needs to be used on the mapping. Signed-off-by: Logan Gunt

[PATCH v8 09/13] nvme-pci: check DMA ops when indicating support for PCI P2PDMA

2022-07-09 Thread Logan Gunthorpe
Introduce a supports_pci_p2pdma() operation in nvme_ctrl_ops to replace the fixed NVME_F_PCI_P2PDMA flag such that the dma_map_ops flags can be checked for PCI P2PDMA support. Signed-off-by: Logan Gunthorpe Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig --- drivers/nvme/host

[PATCH v8 07/13] iommu: Explicitly skip bus address marked segments in __iommu_map_sg()

2022-07-09 Thread Logan Gunthorpe
In order to support PCI P2PDMA mappings with dma-iommu, explicitly skip any segments marked with sg_dma_mark_bus_address() in __iommu_map_sg(). These segments should not be mapped into the IOVA and will be handled separately in as subsequent patch for dma-iommu. Signed-off-by: Logan Gunthorpe

[PATCH v8 13/13] PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg()

2022-07-09 Thread Logan Gunthorpe
This interface is superseded by support in dma_map_sg() which now supports heterogeneous scatterlists. There are no longer any users, so remove it. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Jason Gunthorpe Reviewed-by: Max Gurtovoy Reviewed-by: Christoph Hellwig

[PATCH v8 02/13] PCI/P2PDMA: Attempt to set map_type if it has not been set

2022-07-09 Thread Logan Gunthorpe
time. This change will calculate the mapping type if it hasn't pre-calculated so it is no longer invalid to call pci_p2pdma_map_sg() before the mapping type is calculated, so drop the WARN_ON when that is the case. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Chaitany

[PATCH v8 12/13] RDMA/rw: drop pci_p2pdma_[un]map_sg()

2022-07-09 Thread Logan Gunthorpe
dma_map_sg() now supports the use of P2PDMA pages so pci_p2pdma_map_sg() is no longer necessary and may be dropped. This means the rdma_rw_[un]map_sg() helpers are no longer necessary. Remove it all. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Christoph Hellwig

[PATCH v8 01/13] lib/scatterlist: add flag for indicating P2PDMA segments in an SGL

2022-07-09 Thread Logan Gunthorpe
newer root complexes and roughly require the extra address space for memory BARs used in the transactions. Signed-off-by: Logan Gunthorpe --- drivers/pci/Kconfig | 5 +++ include/linux/scatterlist.h | 69 + 2 files changed, 74 insertions(+) diff

[PATCH v8 11/13] RDMA/core: introduce ib_dma_pci_p2p_dma_supported()

2022-07-09 Thread Logan Gunthorpe
ib_uses_virt_dma(). Adding the dma_pci_p2pdma_supported() check allows switching away from pci_p2pdma_[un]map_sg(). Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Max Gurtovoy Reviewed-by: Christoph Hellwig --- drivers/nvme/target/rdma.c | 2 +- include/rdma

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-06 Thread Logan Gunthorpe
On 2022-07-06 01:04, Greg Kroah-Hartman wrote: > On Wed, Jul 06, 2022 at 08:51:27AM +0200, Christoph Hellwig wrote: >> On Tue, Jul 05, 2022 at 12:16:45PM -0600, Logan Gunthorpe wrote: >>> The current version does it through a char device, but that requires >>&g

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 11:42, Greg Kroah-Hartman wrote: > On Tue, Jul 05, 2022 at 11:32:23AM -0600, Logan Gunthorpe wrote: >> >> >> On 2022-07-05 11:21, Greg Kroah-Hartman wrote: >>> On Tue, Jul 05, 2022 at 06:50:39PM +0200, Christoph Hellwig wrote: >>>> [note

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
o revoke it on device removal] > > We allow mmap on PCIe config space today, right? Why is this different > from what pci_create_legacy_files() does today? > >> On Tue, Jul 05, 2022 at 10:44:49AM -0600, Logan Gunthorpe wrote: >>> We might be able to. I'm not sur

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 10:43, Christoph Hellwig wrote: > On Tue, Jul 05, 2022 at 10:41:52AM -0600, Logan Gunthorpe wrote: >> Using sysfs means we don't need all the messy callbacks from the nvme >> driver, which is a plus. But I'm not sure how we'd get or unmap the >&

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-07-05 Thread Logan Gunthorpe
On 2022-07-05 10:12, Christoph Hellwig wrote: > On Tue, Jul 05, 2022 at 10:51:02AM -0300, Jason Gunthorpe wrote: >>> In fact I'm not even sure this should be a character device, it seems >>> to fit it way better with the PCI sysfs hierchacy, just like how we >>> map MMIO resources, which these a

Re: [PATCH v7 16/21] block: add check when merging zone device pages

2022-06-30 Thread Logan Gunthorpe
On 2022-06-29 10:06, Logan Gunthorpe wrote: > > > > On 2022-06-29 00:46, Christoph Hellwig wrote: >> On Wed, Jun 15, 2022 at 10:12:28AM -0600, Logan Gunthorpe wrote: >>> Consecutive zone device pages should not be merged into the same sgl >>> or bvec seg

Re: [PATCH v7 08/21] iommu/dma: support PCI P2PDMA pages in dma-iommu map_sg

2022-06-30 Thread Logan Gunthorpe
On 2022-06-30 08:56, Robin Murphy wrote: > On 2022-06-29 23:41, Logan Gunthorpe wrote: >> >> >> On 2022-06-29 13:15, Robin Murphy wrote: >>> On 2022-06-29 16:57, Logan Gunthorpe wrote: >>>> >>>> >>>> >>>> On 2022-06-

Re: [PATCH v7 08/21] iommu/dma: support PCI P2PDMA pages in dma-iommu map_sg

2022-06-29 Thread Logan Gunthorpe
On 2022-06-29 13:15, Robin Murphy wrote: > On 2022-06-29 16:57, Logan Gunthorpe wrote: >> >> >> >> On 2022-06-29 06:07, Robin Murphy wrote: >>> On 2022-06-15 17:12, Logan Gunthorpe wrote: >>>> When a PCI P2PDMA page is seen, set the IOVA leng

Re: [PATCH v7 01/21] lib/scatterlist: add flag for indicating P2PDMA segments in an SGL

2022-06-29 Thread Logan Gunthorpe
On 2022-06-29 12:02, Robin Murphy wrote: > On 2022-06-29 16:39, Logan Gunthorpe wrote: >> On 2022-06-29 03:05, Robin Murphy wrote: >>> On 2022-06-15 17:12, Logan Gunthorpe wrote: >>> Does this serve any useful purpose? If a page is determined to be device >>>

Re: [PATCH v7 16/21] block: add check when merging zone device pages

2022-06-29 Thread Logan Gunthorpe
On 2022-06-29 00:46, Christoph Hellwig wrote: > On Wed, Jun 15, 2022 at 10:12:28AM -0600, Logan Gunthorpe wrote: >> Consecutive zone device pages should not be merged into the same sgl >> or bvec segment with other types of pages or if they belong to different >> pgmaps.

Re: [PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-29 Thread Logan Gunthorpe
On 2022-06-29 00:48, Christoph Hellwig wrote: > On Wed, Jun 15, 2022 at 10:12:32AM -0600, Logan Gunthorpe wrote: >> A pseudo mount is used to allocate an inode for each PCI device. The >> inode's address_space is used in the file doing the mmap so that all >> VMA

Re: [PATCH v7 08/21] iommu/dma: support PCI P2PDMA pages in dma-iommu map_sg

2022-06-29 Thread Logan Gunthorpe
On 2022-06-29 06:07, Robin Murphy wrote: > On 2022-06-15 17:12, Logan Gunthorpe wrote: >> When a PCI P2PDMA page is seen, set the IOVA length of the segment >> to zero so that it is not mapped into the IOVA. Then, in finalise_sg(), >> apply the appropriate bus address to

Re: [PATCH v7 01/21] lib/scatterlist: add flag for indicating P2PDMA segments in an SGL

2022-06-29 Thread Logan Gunthorpe
On 2022-06-29 03:05, Robin Murphy wrote: > On 2022-06-15 17:12, Logan Gunthorpe wrote: >> Make use of the third free LSB in scatterlist's page_link on 64bit >> systems. >> >> The extra bit will be used by dma_[un]map_sg_p2pdma() to determine when a >> give

[PATCH v7 05/21] dma-mapping: allow EREMOTEIO return code for P2PDMA transfers

2022-06-15 Thread Logan Gunthorpe
Add EREMOTEIO error return to dma_map_sgtable() which will be used by .map_sg() implementations that detect P2PDMA pages that the underlying DMA device cannot access. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- kernel/dma/mapping.c | 4 +++- 1 file changed, 3 insertions

[PATCH v7 15/21] iov_iter: introduce iov_iter_get_pages_[alloc_]flags()

2022-06-15 Thread Logan Gunthorpe
Add iov_iter_get_pages_flags() and iov_iter_get_pages_alloc_flags() which take a flags argument that is passed to get_user_pages_fast(). This is so that FOLL_PCI_P2PDMA can be passed when appropriate. Signed-off-by: Logan Gunthorpe --- include/linux/uio.h | 6 ++ lib/iov_iter.c | 25

[PATCH v7 03/21] PCI/P2PDMA: Expose pci_p2pdma_map_type()

2022-06-15 Thread Logan Gunthorpe
implementations and don't need to pollute the public pci-p2pdma header Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/pci/p2pdma.c| 25 + include/linux/dma-map-ops.h

[PATCH v7 09/21] nvme-pci: check DMA ops when indicating support for PCI P2PDMA

2022-06-15 Thread Logan Gunthorpe
Introduce a supports_pci_p2pdma() operation in nvme_ctrl_ops to replace the fixed NVME_F_PCI_P2PDMA flag such that the dma_map_ops flags can be checked for PCI P2PDMA support. Signed-off-by: Logan Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/host/core.c | 3 ++- drivers/nvme

[PATCH v7 10/21] nvme-pci: convert to using dma_map_sgtable()

2022-06-15 Thread Logan Gunthorpe
P2PDMA transfer is requested. When this happens, return BLK_STS_TARGET so the request isn't retried. Signed-off-by: Logan Gunthorpe Reviewed-by: Max Gurtovoy Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/host/pci.c | 69 + 1 file change

[PATCH v7 08/21] iommu/dma: support PCI P2PDMA pages in dma-iommu map_sg

2022-06-15 Thread Logan Gunthorpe
IOVA addresses. With this change, the flags variable in the dma_map_ops is set to DMA_F_PCI_P2PDMA_SUPPORTED to indicate support for P2PDMA pages. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- drivers/iommu/dma-iommu.c | 68 +++ 1 file change

[PATCH v7 17/21] lib/scatterlist: add check when merging zone device pages

2022-06-15 Thread Logan Gunthorpe
are not zone device pages or both pages are zone device pages with the same pgmap. Factor out the check for page mergability into a pages_are_mergable() helper and add a check with zone_device_pages_are_mergeable(). Signed-off-by: Logan Gunthorpe --- lib/scatterlist.c | 25

[PATCH v7 06/21] dma-direct: support PCI P2PDMA pages in dma-direct map_sg

2022-06-15 Thread Logan Gunthorpe
thus the mapping operation should fail (and it will return -EREMOTEIO). SGL segments that contain PCI bus addresses are marked with sg_dma_mark_pci_p2pdma() and are ignored when unmapped. P2PDMA mappings are also failed if swiotlb needs to be used on the mapping. Signed-off-by: Logan Gunt

[PATCH v7 16/21] block: add check when merging zone device pages

2022-06-15 Thread Logan Gunthorpe
are not zone device pages or both pages are zone device pages with the same pgmap. Add a helper to determine if zone device pages are mergeable and use this helper in page_is_mergeable(). Signed-off-by: Logan Gunthorpe --- block/bio.c| 2 ++ include/linux/mm.h | 23

[PATCH v7 01/21] lib/scatterlist: add flag for indicating P2PDMA segments in an SGL

2022-06-15 Thread Logan Gunthorpe
n the transactions. Signed-off-by: Logan Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/pci/Kconfig | 5 + include/linux/scatterlist.h | 44 - 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/pci/Kconfig b/driver

[PATCH v7 04/21] PCI/P2PDMA: Introduce helpers for dma_map_sg implementations

2022-06-15 Thread Logan Gunthorpe
2pdma header. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/p2pdma.c| 59 + include/linux/dma-map-ops.h | 21 + 2 files changed, 80 insertions(+) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c

[PATCH v7 19/21] block: set FOLL_PCI_P2PDMA in bio_map_user_iov()

2022-06-15 Thread Logan Gunthorpe
When a bio's queue supports PCI P2PDMA, set FOLL_PCI_P2PDMA for iov_iter_get_pages_flags(). This allows PCI P2PDMA pages to be passed from userspace and enables the NVMe passthru requests to use P2PDMA pages. Signed-off-by: Logan Gunthorpe --- block/blk-map.c | 7 ++- 1 file chang

[PATCH v7 14/21] mm: introduce FOLL_PCI_P2PDMA to gate getting PCI P2PDMA pages

2022-06-15 Thread Logan Gunthorpe
GUP Callers that expect PCI P2PDMA pages can now set FOLL_PCI_P2PDMA to allow obtaining P2PDMA pages. If GUP is called without the flag and a P2PDMA page is found, it will return an error. FOLL_PCI_P2PDMA cannot be set if FOLL_LONGTERM is set. Signed-off-by: Logan Gunthorpe --- include/linux

[PATCH v7 13/21] PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg()

2022-06-15 Thread Logan Gunthorpe
This interface is superseded by support in dma_map_sg() which now supports heterogeneous scatterlists. There are no longer any users, so remove it. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Jason Gunthorpe Reviewed-by: Max Gurtovoy --- drivers/pci/p2pdma.c

[PATCH v7 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-15 Thread Logan Gunthorpe
in a SIGBUS error. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/p2pdma.c | 210 - include/linux/pci-p2pdma.h | 16 +++ include/uapi/linux/magic.h | 1 + 3 files changed, 225 insertions(+), 2 deletions(-) diff --git a/driver

[PATCH v7 02/21] PCI/P2PDMA: Attempt to set map_type if it has not been set

2022-06-15 Thread Logan Gunthorpe
time. This change will calculate the mapping type if it hasn't pre-calculated so it is no longer invalid to call pci_p2pdma_map_sg() before the mapping type is calculated, so drop the WARN_ON when that is the case. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Chaitany

[PATCH v7 00/21] Userspace P2PDMA with O_DIRECT NVMe devices

2022-06-15 Thread Logan Gunthorpe
ected Acks and Reviews by Bjorn, Jason and Max. -- Logan Gunthorpe (21): lib/scatterlist: add flag for indicating P2PDMA segments in an SGL PCI/P2PDMA: Attempt to set map_type if it has not been set PCI/P2PDMA: Expose pci_p2pdma_map_type() PCI/P2PDMA: Introduce helpers for dma_map_sg impl

[PATCH v7 07/21] dma-mapping: add flags to dma_map_ops to indicate PCI P2PDMA support

2022-06-15 Thread Logan Gunthorpe
Add a flags member to the dma_map_ops structure with one flag to indicate support for PCI P2PDMA. Also, add a helper to check if a device supports PCI P2PDMA. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- include/linux/dma-map-ops.h | 10 ++ include/linux/dma

[PATCH v7 11/21] RDMA/core: introduce ib_dma_pci_p2p_dma_supported()

2022-06-15 Thread Logan Gunthorpe
ib_uses_virt_dma(). Adding the dma_pci_p2pdma_supported() check allows switching away from pci_p2pdma_[un]map_sg(). Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Max Gurtovoy --- drivers/nvme/target/rdma.c | 2 +- include/rdma/ib_verbs.h| 11 +++ 2 files

[PATCH v7 21/21] nvme-pci: allow mmaping the CMB in userspace

2022-06-15 Thread Logan Gunthorpe
t set FOLL_PCI_P2PDMA when calling GUP. And inter-device support will be checked the first time the pages are mapped for DMA. Currently this is only supported by O_DIRECT to an PCI NVMe device or through the NVMe passthrough IOCTL. Signed-off-by: Logan Gunthorpe --- drivers/nvme/host/core.c

[PATCH v7 18/21] block: set FOLL_PCI_P2PDMA in __bio_iov_iter_get_pages()

2022-06-15 Thread Logan Gunthorpe
When a bio's queue supports PCI P2PDMA, set FOLL_PCI_P2PDMA for iov_iter_get_pages_flags(). This allows PCI P2PDMA pages to be passed from userspace and enables the O_DIRECT path in iomap based filesystems and direct to block devices. Signed-off-by: Logan Gunthorpe --- block/bio.

[PATCH v7 12/21] RDMA/rw: drop pci_p2pdma_[un]map_sg()

2022-06-15 Thread Logan Gunthorpe
dma_map_sg() now supports the use of P2PDMA pages so pci_p2pdma_map_sg() is no longer necessary and may be dropped. This means the rdma_rw_[un]map_sg() helpers are no longer necessary. Remove it all. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- drivers/infiniband/core/rw.c

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-02 Thread Logan Gunthorpe
On 2022-06-02 11:28, Jason Gunthorpe wrote: > On Thu, Jun 02, 2022 at 10:49:15AM -0600, Logan Gunthorpe wrote: >> >> >> On 2022-06-02 10:30, Jason Gunthorpe wrote: >>> On Thu, Jun 02, 2022 at 10:16:10AM -0600, Logan Gunthorpe wrote: >>> >>>>&g

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-02 Thread Logan Gunthorpe
On 2022-06-02 10:30, Jason Gunthorpe wrote: > On Thu, Jun 02, 2022 at 10:16:10AM -0600, Logan Gunthorpe wrote: > >>> Just stuff the pages into the mmap, and your driver unprobe will >>> automatically block until all the mmaps are closed - no different than >>>

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-02 Thread Logan Gunthorpe
On 2022-06-02 10:30, Jason Gunthorpe wrote: > On Thu, Jun 02, 2022 at 10:16:10AM -0600, Logan Gunthorpe wrote: > >>> Just stuff the pages into the mmap, and your driver unprobe will >>> automatically block until all the mmaps are closed - no different than >>&g

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-06-02 Thread Logan Gunthorpe
On 2022-06-01 18:00, Jason Gunthorpe wrote: > On Fri, May 27, 2022 at 04:41:08PM -0600, Logan Gunthorpe wrote: >>> >>> IIRC this is the last part: >>> >>> https://lore.kernel.org/linux-mm/20220524190632.3304-1-alex.sie...@amd.com/ >>> >>&g

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-05-27 Thread Logan Gunthorpe
On 2022-05-27 13:03, Jason Gunthorpe wrote: > On Fri, May 27, 2022 at 09:35:07AM -0600, Logan Gunthorpe wrote: >> >> >> On 2022-05-27 06:55, Jason Gunthorpe wrote: >>> On Thu, Apr 07, 2022 at 09:47:16AM -0600, Logan Gunthorpe wrote: >>>> +static

Re: [PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-05-27 Thread Logan Gunthorpe
On 2022-05-27 06:55, Jason Gunthorpe wrote: > On Thu, Apr 07, 2022 at 09:47:16AM -0600, Logan Gunthorpe wrote: >> +static void pci_p2pdma_unmap_mappings(void *data) >> +{ >> +struct pci_dev *pdev = data; >> +struct pci_p2pdma *p2pdma = rcu_dereferenc

Re: [PATCH v6 00/21] Userspace P2PDMA with O_DIRECT NVMe devices

2022-05-16 Thread Logan Gunthorpe
On 2022-05-16 16:31, Chaitanya Kulkarni wrote: > Do you have any plans to re-spin this ? I didn't get any feedback this cycle, so there haven't been any changes. I'll probably do a rebase and resend after the merge window. Logan ___ iommu mailing lis

[PATCH v6 21/21] nvme-pci: allow mmaping the CMB in userspace

2022-04-07 Thread Logan Gunthorpe
t set FOLL_PCI_P2PDMA when calling GUP. And inter-device support will be checked the first time the pages are mapped for DMA. Currently this is only supported by O_DIRECT to an PCI NVMe device or through the NVMe passthrough IOCTL. Signed-off-by: Logan Gunthorpe --- drivers/nvme/host/core.c

[PATCH v6 12/21] RDMA/rw: drop pci_p2pdma_[un]map_sg()

2022-04-07 Thread Logan Gunthorpe
dma_map_sg() now supports the use of P2PDMA pages so pci_p2pdma_map_sg() is no longer necessary and may be dropped. This means the rdma_rw_[un]map_sg() helpers are no longer necessary. Remove it all. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- drivers/infiniband/core/rw.c

[PATCH v6 00/21] Userspace P2PDMA with O_DIRECT NVMe devices

2022-04-07 Thread Logan Gunthorpe
on. - Collected Acks and Reviews by Bjorn, Jason and Max. Logan Gunthorpe (21): lib/scatterlist: add flag for indicating P2PDMA segments in an SGL PCI/P2PDMA: Attempt to set map_type if it has not been set PCI/P2PDMA: Expose pci_p2pdma_map_type() PCI/P2PDMA: Introduce helpers for dma_map

[PATCH v6 02/21] PCI/P2PDMA: Attempt to set map_type if it has not been set

2022-04-07 Thread Logan Gunthorpe
time. This change will calculate the mapping type if it hasn't pre-calculated so it is no longer invalid to call pci_p2pdma_map_sg() before the mapping type is calculated, so drop the WARN_ON when that is the case. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Chaitany

[PATCH v6 16/21] block: add check when merging zone device pages

2022-04-07 Thread Logan Gunthorpe
are not zone device pages or both pages are zone device pages with the same pgmap. Add a helper to determine if zone device pages are mergeable and use this helper in page_is_mergeable(). Signed-off-by: Logan Gunthorpe --- block/bio.c| 2 ++ include/linux/mm.h | 23

[PATCH v6 14/21] mm: introduce FOLL_PCI_P2PDMA to gate getting PCI P2PDMA pages

2022-04-07 Thread Logan Gunthorpe
GUP Callers that expect PCI P2PDMA pages can now set FOLL_PCI_P2PDMA to allow obtaining P2PDMA pages. If GUP is called without the flag and a P2PDMA page is found, it will return an error. FOLL_PCI_P2PDMA cannot be set if FOLL_LONGTERM is set. Signed-off-by: Logan Gunthorpe --- include/linux

[PATCH v6 19/21] block: set FOLL_PCI_P2PDMA in bio_map_user_iov()

2022-04-07 Thread Logan Gunthorpe
When a bio's queue supports PCI P2PDMA, set FOLL_PCI_P2PDMA for iov_iter_get_pages_flags(). This allows PCI P2PDMA pages to be passed from userspace and enables the NVMe passthru requests to use P2PDMA pages. Signed-off-by: Logan Gunthorpe --- block/blk-map.c | 7 ++- 1 file chang

[PATCH v6 04/21] PCI/P2PDMA: Introduce helpers for dma_map_sg implementations

2022-04-07 Thread Logan Gunthorpe
2pdma header. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/p2pdma.c| 59 + include/linux/dma-map-ops.h | 21 + 2 files changed, 80 insertions(+) diff --git a/drivers/pci/p2pdma.c b/drivers/pci/p2pdma.c

[PATCH v6 01/21] lib/scatterlist: add flag for indicating P2PDMA segments in an SGL

2022-04-07 Thread Logan Gunthorpe
n the transactions. Signed-off-by: Logan Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/pci/Kconfig | 5 + include/linux/scatterlist.h | 44 - 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/drivers/pci/Kconfig b/driver

[PATCH v6 07/21] dma-mapping: add flags to dma_map_ops to indicate PCI P2PDMA support

2022-04-07 Thread Logan Gunthorpe
Add a flags member to the dma_map_ops structure with one flag to indicate support for PCI P2PDMA. Also, add a helper to check if a device supports PCI P2PDMA. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- include/linux/dma-map-ops.h | 10 ++ include/linux/dma

[PATCH v6 08/21] iommu/dma: support PCI P2PDMA pages in dma-iommu map_sg

2022-04-07 Thread Logan Gunthorpe
IOVA addresses. With this change, the flags variable in the dma_map_ops is set to DMA_F_PCI_P2PDMA_SUPPORTED to indicate support for P2PDMA pages. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- drivers/iommu/dma-iommu.c | 68 +++ 1 file change

[PATCH v6 13/21] PCI/P2PDMA: Remove pci_p2pdma_[un]map_sg()

2022-04-07 Thread Logan Gunthorpe
This interface is superseded by support in dma_map_sg() which now supports heterogeneous scatterlists. There are no longer any users, so remove it. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Jason Gunthorpe Reviewed-by: Max Gurtovoy --- drivers/pci/p2pdma.c

[PATCH v6 20/21] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2022-04-07 Thread Logan Gunthorpe
in a SIGBUS error. Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas --- drivers/pci/p2pdma.c | 340 - include/linux/pci-p2pdma.h | 11 ++ include/uapi/linux/magic.h | 1 + 3 files changed, 350 insertions(+), 2 deletions(-) diff --git a/driver

[PATCH v6 18/21] block: set FOLL_PCI_P2PDMA in __bio_iov_iter_get_pages()

2022-04-07 Thread Logan Gunthorpe
When a bio's queue supports PCI P2PDMA, set FOLL_PCI_P2PDMA for iov_iter_get_pages_flags(). This allows PCI P2PDMA pages to be passed from userspace and enables the O_DIRECT path in iomap based filesystems and direct to block devices. Signed-off-by: Logan Gunthorpe --- block/bio.

[PATCH v6 15/21] iov_iter: introduce iov_iter_get_pages_[alloc_]flags()

2022-04-07 Thread Logan Gunthorpe
Add iov_iter_get_pages_flags() and iov_iter_get_pages_alloc_flags() which take a flags argument that is passed to get_user_pages_fast(). This is so that FOLL_PCI_P2PDMA can be passed when appropriate. Signed-off-by: Logan Gunthorpe --- include/linux/uio.h | 6 ++ lib/iov_iter.c | 25

[PATCH v6 03/21] PCI/P2PDMA: Expose pci_p2pdma_map_type()

2022-04-07 Thread Logan Gunthorpe
implementations and don't need to pollute the public pci-p2pdma header Signed-off-by: Logan Gunthorpe Acked-by: Bjorn Helgaas Reviewed-by: Jason Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/pci/p2pdma.c| 25 + include/linux/dma-map-ops.h

[PATCH v6 10/21] nvme-pci: convert to using dma_map_sgtable()

2022-04-07 Thread Logan Gunthorpe
P2PDMA transfer is requested. When this happens, return BLK_STS_TARGET so the request isn't retried. Signed-off-by: Logan Gunthorpe Reviewed-by: Max Gurtovoy Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/host/pci.c | 69 + 1 file change

[PATCH v6 05/21] dma-mapping: allow EREMOTEIO return code for P2PDMA transfers

2022-04-07 Thread Logan Gunthorpe
Add EREMOTEIO error return to dma_map_sgtable() which will be used by .map_sg() implementations that detect P2PDMA pages that the underlying DMA device cannot access. Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe --- kernel/dma/mapping.c | 4 +++- 1 file changed, 3 insertions

[PATCH v6 06/21] dma-direct: support PCI P2PDMA pages in dma-direct map_sg

2022-04-07 Thread Logan Gunthorpe
thus the mapping operation should fail (and it will return -EREMOTEIO). SGL segments that contain PCI bus addresses are marked with sg_dma_mark_pci_p2pdma() and are ignored when unmapped. P2PDMA mappings are also failed if swiotlb needs to be used on the mapping. Signed-off-by: Logan Gunt

[PATCH v6 17/21] lib/scatterlist: add check when merging zone device pages

2022-04-07 Thread Logan Gunthorpe
are not zone device pages or both pages are zone device pages with the same pgmap. Factor out the check for page mergability into a pages_are_mergable() helper and add a check with zone_device_pages_are_mergeable(). Signed-off-by: Logan Gunthorpe --- lib/scatterlist.c | 25

[PATCH v6 11/21] RDMA/core: introduce ib_dma_pci_p2p_dma_supported()

2022-04-07 Thread Logan Gunthorpe
ib_uses_virt_dma(). Adding the dma_pci_p2pdma_supported() check allows switching away from pci_p2pdma_[un]map_sg(). Signed-off-by: Logan Gunthorpe Reviewed-by: Jason Gunthorpe Reviewed-by: Max Gurtovoy --- drivers/nvme/target/rdma.c | 2 +- include/rdma/ib_verbs.h| 11 +++ 2 files

[PATCH v6 09/21] nvme-pci: check DMA ops when indicating support for PCI P2PDMA

2022-04-07 Thread Logan Gunthorpe
Introduce a supports_pci_p2pdma() operation in nvme_ctrl_ops to replace the fixed NVME_F_PCI_P2PDMA flag such that the dma_map_ops flags can be checked for PCI P2PDMA support. Signed-off-by: Logan Gunthorpe Reviewed-by: Chaitanya Kulkarni --- drivers/nvme/host/core.c | 3 ++- drivers/nvme

Re: [PATCH 09/27] mm: generalize the pgmap based page_free infrastructure

2022-02-14 Thread Logan Gunthorpe
r. Reviewed-by: Logan Gunthorpe > --- > mm/memremap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/memremap.c b/mm/memremap.c > index fef5734d5e4933..e00ffcdba7b632 100644 > --- a/mm/memremap.c > +++ b/mm/memremap.c > @@ -452,7 +

Re: [PATCH 09/27] mm: generalize the pgmap based page_free infrastructure

2022-02-14 Thread Logan Gunthorpe
r. Reviewed-by: Logan Gunthorpe > --- > mm/memremap.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/mm/memremap.c b/mm/memremap.c > index fef5734d5e4933..e00ffcdba7b632 100644 > --- a/mm/memremap.c > +++ b/mm/memremap.c > @@ -452,7 +

  1   2   3   4   5   6   7   8   9   10   >