Jason Gunthorpe
2025-Jul-23 03:55 UTC
[PATCH v2 4/5] RDMA/mlx5: Enable P2P DMA with fallback mechanism
On Mon, Jul 21, 2025 at 12:03:41AM -0700, Christoph Hellwig wrote:> On Fri, Jul 18, 2025 at 02:51:11PM +0300, Yonatan Maman wrote: > > From: Yonatan Maman <Ymaman at Nvidia.com> > > > > Add support for P2P for MLX5 NIC devices with automatic fallback to > > standard DMA when P2P mapping fails. > > That's now how the P2P API works. You need to check the P2P availability > higher up.How do you mean? This looks OKish to me, for ODP and HMM it has to check the P2P availability on a page by page basis because every single page can be a different origin device. There isn't really a higher up here... Jason
Christoph Hellwig
2025-Jul-24 07:30 UTC
[PATCH v2 4/5] RDMA/mlx5: Enable P2P DMA with fallback mechanism
On Wed, Jul 23, 2025 at 12:55:22AM -0300, Jason Gunthorpe wrote:> On Mon, Jul 21, 2025 at 12:03:41AM -0700, Christoph Hellwig wrote: > > On Fri, Jul 18, 2025 at 02:51:11PM +0300, Yonatan Maman wrote: > > > From: Yonatan Maman <Ymaman at Nvidia.com> > > > > > > Add support for P2P for MLX5 NIC devices with automatic fallback to > > > standard DMA when P2P mapping fails. > > > > That's now how the P2P API works. You need to check the P2P availability > > higher up. > > How do you mean? > > This looks OKish to me, for ODP and HMM it has to check the P2P > availability on a page by page basis because every single page can be > a different origin device. > > There isn't really a higher up here...The DMA API expects the caller to already check for connectability, why can't HMM do that like everyone else?
Jason Gunthorpe
2025-Aug-01 16:46 UTC
[PATCH v2 4/5] RDMA/mlx5: Enable P2P DMA with fallback mechanism
On Thu, Jul 24, 2025 at 12:30:34AM -0700, Christoph Hellwig wrote:> On Wed, Jul 23, 2025 at 12:55:22AM -0300, Jason Gunthorpe wrote: > > On Mon, Jul 21, 2025 at 12:03:41AM -0700, Christoph Hellwig wrote: > > > On Fri, Jul 18, 2025 at 02:51:11PM +0300, Yonatan Maman wrote: > > > > From: Yonatan Maman <Ymaman at Nvidia.com> > > > > > > > > Add support for P2P for MLX5 NIC devices with automatic fallback to > > > > standard DMA when P2P mapping fails. > > > > > > That's now how the P2P API works. You need to check the P2P availability > > > higher up. > > > > How do you mean? > > > > This looks OKish to me, for ODP and HMM it has to check the P2P > > availability on a page by page basis because every single page can be > > a different origin device. > > > > There isn't really a higher up here... > > The DMA API expects the caller to already check for connectability, > why can't HMM do that like everyone else?It does, this doesn't change anything about how the DMA API works. All this series does, and you stated it perfectly, is to allow HMM to return the single PCI P2P alias of the device private page. HMM already blindly returns normal P2P pages in a VMA, it should also blindly return the P2P alias pages too. Once the P2P is returned the xisting code in hmm_dma_map_pfn() calls pci_p2pdma_state() to find out if it is compatible or not. Lifting the pci_p2pdma_state() from hmm_dma_map_pfn() and into hmm_range_fault() is perhaps possible and may be reasonable, but not really related to this series. Jason