Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
On 2020-11-06 5:14 p.m., Jason Gunthorpe wrote: > On Fri, Nov 06, 2020 at 01:03:26PM -0700, Logan Gunthorpe wrote: >> I don't think a function like that will work for the p2pmem use case. In >> order to implement proper page freeing I expect I'll need a loop around >> the allocator and vm_insert

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Jason Gunthorpe
On Fri, Nov 06, 2020 at 01:03:26PM -0700, Logan Gunthorpe wrote: > I don't think a function like that will work for the p2pmem use case. In > order to implement proper page freeing I expect I'll need a loop around > the allocator and vm_insert_mixed()... Something roughly like: > > for (addr = vma

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
On 2020-11-06 12:53 p.m., Jason Gunthorpe wrote: > On Fri, Nov 06, 2020 at 12:44:59PM -0700, Logan Gunthorpe wrote: >> >> >> On 2020-11-06 12:30 p.m., Jason Gunthorpe wrote: I certainly can't make decisions for code that isn't currently upstream. >>> >>> The rdma drivers are all upstr

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Jason Gunthorpe
On Fri, Nov 06, 2020 at 12:44:59PM -0700, Logan Gunthorpe wrote: > > > On 2020-11-06 12:30 p.m., Jason Gunthorpe wrote: > >> I certainly can't make decisions for code that isn't currently > >> upstream. > > > > The rdma drivers are all upstream, what are you thinking about? > > Really? I feel l

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
On 2020-11-06 12:30 p.m., Jason Gunthorpe wrote: >> I certainly can't make decisions for code that isn't currently >> upstream. > > The rdma drivers are all upstream, what are you thinking about? Really? I feel like you should know what I mean here... I mean upstream code that actually uses t

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Jason Gunthorpe
On Fri, Nov 06, 2020 at 11:20:05AM -0700, Logan Gunthorpe wrote: > > > On 2020-11-06 11:09 a.m., Jason Gunthorpe wrote: > >> Ah, hmm, yes. I guess the pages have to be hooked and returned to the > >> genalloc through free_devmap_managed_page(). > > > > That sounds about right, but in this case

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
On 2020-11-06 11:09 a.m., Jason Gunthorpe wrote: >> Ah, hmm, yes. I guess the pages have to be hooked and returned to the >> genalloc through free_devmap_managed_page(). > > That sounds about right, but in this case it doesn't need the VMA > operations. > >> Seems like it might be doable... b

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Jason Gunthorpe
On Fri, Nov 06, 2020 at 10:53:45AM -0700, Logan Gunthorpe wrote: > > > On 2020-11-06 10:42 a.m., Jason Gunthorpe wrote: > > On Fri, Nov 06, 2020 at 10:28:00AM -0700, Logan Gunthorpe wrote: > >> > >> > >> On 2020-11-06 10:22 a.m., Jason Gunthorpe wrote: > >>> On Fri, Nov 06, 2020 at 10:00:35AM -07

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
On 2020-11-06 10:42 a.m., Jason Gunthorpe wrote: > On Fri, Nov 06, 2020 at 10:28:00AM -0700, Logan Gunthorpe wrote: >> >> >> On 2020-11-06 10:22 a.m., Jason Gunthorpe wrote: >>> On Fri, Nov 06, 2020 at 10:00:35AM -0700, Logan Gunthorpe wrote: Introduce pci_mmap_p2pmem() which is a helper to

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Jason Gunthorpe
On Fri, Nov 06, 2020 at 10:28:00AM -0700, Logan Gunthorpe wrote: > > > On 2020-11-06 10:22 a.m., Jason Gunthorpe wrote: > > On Fri, Nov 06, 2020 at 10:00:35AM -0700, Logan Gunthorpe wrote: > >> Introduce pci_mmap_p2pmem() which is a helper to allocate and mmap > >> a hunk of p2pmem into userspace

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
On 2020-11-06 10:22 a.m., Jason Gunthorpe wrote: > On Fri, Nov 06, 2020 at 10:00:35AM -0700, Logan Gunthorpe wrote: >> Introduce pci_mmap_p2pmem() which is a helper to allocate and mmap >> a hunk of p2pmem into userspace. >> >> Signed-off-by: Logan Gunthorpe >> drivers/pci/p2pdma.c | 104

Re: [RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Jason Gunthorpe
On Fri, Nov 06, 2020 at 10:00:35AM -0700, Logan Gunthorpe wrote: > Introduce pci_mmap_p2pmem() which is a helper to allocate and mmap > a hunk of p2pmem into userspace. > > Signed-off-by: Logan Gunthorpe > drivers/pci/p2pdma.c | 104 + > include/linux/pc

[RFC PATCH 14/15] PCI/P2PDMA: Introduce pci_mmap_p2pmem()

2020-11-06 Thread Logan Gunthorpe
Introduce pci_mmap_p2pmem() which is a helper to allocate and mmap a hunk of p2pmem into userspace. Signed-off-by: Logan Gunthorpe --- drivers/pci/p2pdma.c | 104 + include/linux/pci-p2pdma.h | 6 +++ 2 files changed, 110 insertions(+) diff --git a/dr