On Mon, Jul 21, 2025 at 09:49:04AM +0300, Leon Romanovsky wrote: > > In fact, hmm_range_fault doesn't have information about the destination > > device that will perform the DMA mapping. > > So probably you need to teach HMM to perform page_faults on specific device.
That isn't how the HMM side is supposed to work, this API is just giving the one and only P2P page that is backing the device private. The providing driver shouldn't be doing any p2pdma operations to check feasibility. Otherwise we are doing p2p operations twice on every page, doesn't make sense. We've consistently been saying the P2P is done during the DMA mapping side only, I think we should stick with that. Failing P2P is an exception case, and the fix is to trigger page migration which the general hmm code knows how to do. So calling hmm range fault again makes sense to me. I wouldn't want drivers open coding the migration logic in the new callback. Jason