On Tue, Oct 27, 2020 at 05:32:26PM +0000, Xiong, Jianxin wrote: > > On Mon, Oct 26, 2020 at 09:26:37AM -0300, Jason Gunthorpe wrote: > > > On Sat, Oct 24, 2020 at 08:48:07AM +0100, Christoph Hellwig wrote: > > > > On Fri, Oct 23, 2020 at 03:20:05PM -0300, Jason Gunthorpe wrote: > > > > > The problem is we have RDMA drivers that assume SGL's have a valid > > > > > struct page, and these hacky/wrong P2P sgls that DMABUF creates > > > > > cannot be passed into those drivers. > > > > > > > > RDMA drivers do not assume scatterlist have a valid struct page, > > > > scatterlists are defined to have a valid struct page. Any > > > > scatterlist without a struct page is completely buggy. > > > > > > It is not just having the struct page, it needs to be a CPU accessible > > > one for memcpy/etc. They aren't correct with the > > > MEMORY_DEVICE_PCI_P2PDMA SGLs either. > > > > Exactly. > > In the function ib_umem_dmabuf_sgt_slice() (part of this patch) we could generate > a dma address array instead of filling the scatterlist > 'umem->sg_head'. I don't think we should change the format, the SGL comes out of the dmabuf and all the umem code is able to process it like that. Adding another datastructure just for this one case is going to be trouble. Ultimately I'd like to see some 'dma only sgl', CH has been talking about this for a while. When we have that settled just change everything connected to umem I think in the meantime the answer for this patch is drivers just can't call these APIs and use the struct page side, just like they can't call the DMA buf API and use the struct page side.. Jason