Re: [PATCH v4 03/18] PCI/P2PDMA: Restrict the p2pmem search to pool backed providers

[email protected]
Newsgroups org.kernel.vger.linux-pci
Message-ID <[email protected]>
> From: Leon Romanovsky <[email protected]>
> 
> pci_p2pmem_find_many() exists to pick a provider that the caller will
> then allocate from with pci_alloc_p2pmem(), which goes straight to the
> gen_pool:
> 
> 	ret = (void *)gen_pool_alloc_owner(p2pdma->pool, size, (void **) &ref);
> 
> pci_has_p2pmem() does not ask for that pool, only for the published flag.
> The two used to be equivalent, because a provider could only exist by way
> of pci_p2pdma_add_resource(), which always creates the pool.
> 
> pcim_p2pdma_init() broke that. It registers a provider for the DMABUF
> path and never creates a pool, so pdev->p2pdma is set while
> p2pdma->pool stays NULL. Nothing publishes such a provider today, so the
> search cannot return one yet, but the flag alone no longer says what the
> caller needs.
> 
> Ask for the pool as well, so the search covers the providers its result
> is used for. A later patch documents the pdev->p2pdma lifetime and RCU
> rules.
> 
> Tested-by: Tushar Dave <[email protected]>
> Signed-off-by: Leon Romanovsky <[email protected]>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.