]> www.infradead.org Git - users/dwmw2/linux.git/commit
io_uring/zcrx: fix late dma unmap for a dead dev
authorPavel Begunkov <asml.silence@gmail.com>
Fri, 18 Apr 2025 12:02:27 +0000 (13:02 +0100)
committerJens Axboe <axboe@kernel.dk>
Fri, 18 Apr 2025 12:12:10 +0000 (06:12 -0600)
commitf12ecf5e1c5eca48b8652e893afcdb730384a6aa
treee0532122ae62cd9b34c75afe12957696179ad541
parentb419bed4f0a62c65a57dd495185821dd56bc435c
io_uring/zcrx: fix late dma unmap for a dead dev

There is a problem with page pools not dma-unmapping immediately when
the device is going down, and delaying it until the page pool is
destroyed, which is not allowed (see links). That just got fixed for
normal page pools, and we need to address memory providers as well.

Unmap pages in the memory provider uninstall callback, and protect it
with a new lock. There is also a gap between when a dma mapping is
created and the mp is installed, so if the device is killed in between,
io_uring would be holding on to dma mappings to a dead device with no
one to call ->uninstall. Move it to page pool init and rely on
->is_mapped to make sure it's only done once.

Link: https://lore.kernel.org/lkml/8067f204-1380-4d37-8ffd-007fc6f26738@kernel.org/T/
Link: https://lore.kernel.org/all/20250409-page-pool-track-dma-v9-0-6a9ef2e0cba8@redhat.com/
Fixes: 34a3e60821ab9 ("io_uring/zcrx: implement zerocopy receive pp memory provider")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/ef9b7db249b14f6e0b570a1bb77ff177389f881c.1744965853.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
io_uring/zcrx.c
io_uring/zcrx.h