• Jens Axboe's avatar
    io_uring: add support for user mapped provided buffer ring · c56e022c
    Jens Axboe authored
    The ring mapped provided buffer rings rely on the application allocating
    the memory for the ring, and then the kernel will map it. This generally
    works fine, but runs into issues on some architectures where we need
    to be able to ensure that the kernel and application virtual address for
    the ring play nicely together. This at least impacts architectures that
    set SHM_COLOUR, but potentially also anyone setting SHMLBA.
    
    To use this variant of ring provided buffers, the application need not
    allocate any memory for the ring. Instead the kernel will do so, and
    the allocation must subsequently call mmap(2) on the ring with the
    offset set to:
    
    	IORING_OFF_PBUF_RING | (bgid << IORING_OFF_PBUF_SHIFT)
    
    to get a virtual address for the buffer ring. Normally the application
    would allocate a suitable piece of memory (and correctly aligned) and
    simply pass that in via io_uring_buf_reg.ring_addr and the kernel would
    map it.
    
    Outside of the setup differences, the kernel allocate + user mapped
    provided buffer ring works exactly the same.
    Acked-by: default avatarHelge Deller <deller@gmx.de>
    Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
    c56e022c
kbuf.h 3.76 KB