On 10/20/25 8:58 AM, Jan Kara wrote:
On Mon 20-10-25 15:59:07, Matthew Wilcox wrote:
quoted
On Mon, Oct 20, 2025 at 03:59:33PM +0200, Jan Kara wrote:
quoted
The idea was to bounce buffer the page we are writing back in case we spot
a long-term pin we cannot just wait for - hence bouncing should be rare.
But in this more general setting it is challenging to not bounce buffer for
every IO (in which case you'd be basically at performance of RWF_DONTCACHE
IO or perhaps worse so why bother?). Essentially if you hand out the real
page underlying the buffer for the IO, all other attemps to do IO to that
page have to block - bouncing is no longer an option because even with
bouncing the second IO we could still corrupt data of the first IO once we
copy to the final buffer. And if we'd block waiting for the first IO to
complete, userspace could construct deadlock cycles - like racing IO to
pages A, B with IO to pages B, A. So far I'm not sure about a sane way out
of this...
There isn't one. We might have DMA-mapped this page earlier, and so a
device could write to it at any time. Even if we remove PTE write
permissions ...
True but writes through DMA to the page are guarded by holding a page pin
these days so we could in theory block getting another page pin or mapping
Do you mean, "setting up to do DMA is guarded by holding a FOLL_LONGTERM
page pin"? Or something else (that's new to me)?
thanks,
John Hubbard
the page writeably until the pin is released... if we can figure out a
convincing story for dealing with long-term pins from RDMA and dealing with
possible deadlocks created by this.
Honza