[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aPYqliGwJTcZznSX@infradead.org>
Date: Mon, 20 Oct 2025 05:27:02 -0700
From: Christoph Hellwig <hch@...radead.org>
To: Jason Gunthorpe <jgg@...dia.com>
Cc: Christoph Hellwig <hch@...radead.org>,
Leon Romanovsky <leon@...nel.org>,
Alex Williamson <alex.williamson@...hat.com>,
Leon Romanovsky <leonro@...dia.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Bjorn Helgaas <bhelgaas@...gle.com>,
Christian König <christian.koenig@....com>,
dri-devel@...ts.freedesktop.org, iommu@...ts.linux.dev,
Jens Axboe <axboe@...nel.dk>, Joerg Roedel <joro@...tes.org>,
kvm@...r.kernel.org, linaro-mm-sig@...ts.linaro.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-media@...r.kernel.org, linux-mm@...ck.org,
linux-pci@...r.kernel.org, Logan Gunthorpe <logang@...tatee.com>,
Marek Szyprowski <m.szyprowski@...sung.com>,
Robin Murphy <robin.murphy@....com>,
Sumit Semwal <sumit.semwal@...aro.org>,
Vivek Kasireddy <vivek.kasireddy@...el.com>,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH v5 1/9] PCI/P2PDMA: Separate the mmap() support from the
core logic
On Fri, Oct 17, 2025 at 08:53:20AM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 16, 2025 at 11:30:06PM -0700, Christoph Hellwig wrote:
> > On Mon, Oct 13, 2025 at 06:26:03PM +0300, Leon Romanovsky wrote:
> > > The DMA API now has a new flow, and has gained phys_addr_t support, so
> > > it no longer needs struct pages to perform P2P mapping.
> >
> > That's news to me. All the pci_p2pdma_map_state machinery is still
> > based on pgmaps and thus pages.
>
> We had this discussion already three months ago:
>
> https://lore.kernel.org/all/20250729131502.GJ36037@nvidia.com/
>
> These couple patches make the core pci_p2pdma_map_state machinery work
> on struct p2pdma_provider, and pgmap is just one way to get a
> p2pdma_provider *
>
> The struct page paths through pgmap go page->pgmap->mem to get
> p2pdma_provider.
>
> The non-struct page paths just have a p2pdma_provider * without a
> pgmap. In this series VFIO uses
>
> + *provider = pcim_p2pdma_provider(pdev, bar);
>
> To get the provider for a specific BAR.
And what protects that life time? I've not seen anyone actually
building the proper lifetime management. And if someone did the patches
need to clearly point to that.
> I think I've answered this three times now - for DMABUF the DMABUF
> invalidation scheme is used to control the lifetime and no DMA mapping
> outlives the provider, and the provider doesn't outlive the driver.
How?
> Obviously you cannot use the new p2provider mechanism without some
> kind of protection against use after hot unplug, but it doesn't have
> to be struct page based.
And how does this interact with everyone else expecting pgmap based
lifetime management.
Powered by blists - more mailing lists