On Tue, Oct 15, 2024 at 3:16 AM Jakub Kicinski <kuba@xxxxxxxxxx> wrote: > > On Tue, 15 Oct 2024 01:38:20 +0300 Mina Almasry wrote: > > Thanks Jason. In that case I agree with Jakub we should take in his change here: > > > > https://lore.kernel.org/netdev/20241009170102.1980ed1d@xxxxxxxxxx/ > > > > With this change the driver would delegate dma_sync_for_device to the > > page_pool, and the page_pool will skip it altogether for the dma-buf > > memory provider. > > And we need a wrapper for a sync for CPU which will skip if the page > comes from an unreadable pool? This is where it gets a bit tricky, no? Our production code does a dma_sync_for_cpu but no dma_sync_for_device. That has been working reliably for us with GPU dmabufs and udmabuf, but we haven't of course tested every dma-buf. I'm comfortable enforcing the 'no dma_sync_for_device' now since it brings upstream in line with our well tested setup. I'm not sure I'm 100% comfortable enforcing the 'no dma_sync_for_cpu' now since it's a deviation. The dma_sync_for_cpu is very very likely a no-op since we don't really access the data from cpu ever with devmem TCP, but who knows. Is it possible to give me a couple of weeks to make this change locally and run it through some testing to see if it breaks anything? But if you or Jason think that enforcing the 'no dma_buf_sync_for_cpu' now is critical, no problem. We can also provide this patch, and seek to revert it or fix it up properly later in the event it turns out it causes issues. Note that io_uring provider, or other non-dmabuf providers may need to do a dma-sync, but that bridge can be crossed in David's patchset. -- Thanks, Mina