Re: [PATCH net-next v10 02/14] net: page_pool: create hooks for custom page providers

From: Christian König
Date: Tue Jun 11 2024 - 04:22:41 EST


Am 11.06.24 um 08:25 schrieb Christoph Hellwig:
On Mon, Jun 10, 2024 at 02:38:18PM +0200, Christian König wrote:
Well there is the fundamental problem that you can't use io_uring to
implement the semantics necessary for a dma_fence.
What is the exact problem there?

It's an intentional design decision that dma_fences can be waited on with quite a bunch of locks held. Including the DMA-buf reservation lock, mmap lock, anything page fault related, shrinker etc...

When you give userspace control over the signaling of a dma_fence then that has the same effect as returning to userspace with those locks held - you can basically trivially deadlock the system.

I think nearly a dozen implementations fell into that trap: https://www.kernel.org/doc/html/v5.9/driver-api/dma-buf.html#indefinite-dma-fences

It's well understood and documented by now why this approach doesn't work. So not much of an issue any more, we just have to reject implementations from time to time which try doing the same thing again.

Regards,
Christian.