io_uring/rsrc: fix build without DMA_SHARED_BUFFER
PATCH 1/1 io_uring/rsrc: fix build without DMA_SHARED_BUFFER
io_register_dmabuf_desc() calls io_register_dmabuf() unconditionally, but io_uring/dma-buf.o is only built with CONFIG_DMA_SHARED_BUFFER enabled. This causes an undefined reference to io_register_dmabuf() when linking kernels with CONFIG_IO_URING=y and CONFIG_DMA_SHARED_BUFFER=n, as reported by KernelCI for i386 allnoconfig and ARC haps_hs_smp_defconfig builds.
Move the configuration check from io_register_dmabuf() to io_register_dmabuf_desc(), before allocating the resource node and mapped buffer. This lets the compiler eliminate the call when DMA-BUF support is disabled and rejects DMA-BUF registration with -EOPNOTSUPP. The check in io_register_dmabuf() cannot handle this configuration because its object file is not built.
--- io_uring/dma-buf.c | 2 -- io_uring/rsrc.c | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)
io_uring/dma-buf.c +0 -2
@@ -18,8 +18,6 @@ int io_register_dmabuf(struct io_ring_ctx *ctx,struct dma_buf *dmabuf =NULL ;int ret; -if (!IS_ENABLED (CONFIG_DMA_SHARED_BUFFER )) -return -EOPNOTSUPP ;if (ctx->flags &IORING_SETUP_IOPOLL )return -EOPNOTSUPP ;if (desc->uaddr || desc->size)
io_uring/rsrc.c +3 -0
@@ -907,6 +907,9 @@ static struct io_rsrc_node *io_register_dmabuf_desc(struct io_ring_ctx *ctx,struct io_mapped_ubuf *imu =NULL ;int ret; +if (!IS_ENABLED (CONFIG_DMA_SHARED_BUFFER )) +return ERR_PTR (-EOPNOTSUPP ); + node =io_rsrc_node_alloc (ctx,IORING_RSRC_BUFFER );if (!node)return ERR_PTR (-ENOMEM );
Hi Sasha,
Quoted 13 lines
io_register_dmabuf_desc()callsio_register_dmabuf()unconditionally, butio_uring/dma-buf.ois only built withCONFIG_DMA_SHARED_BUFFERenabled. This causes an undefined reference toio_register_dmabuf()when linking kernels withCONFIG_IO_URING=yandCONFIG_DMA_SHARED_BUFFER=n, as reported by KernelCI for i386 allnoconfig and ARChaps_hs_smp_defconfigbuilds.Move the configuration check from
io_register_dmabuf()toio_register_dmabuf_desc(), before allocating the resource node and mapped buffer. This lets the compiler eliminate the call when DMA-BUF support is disabled and rejects DMA-BUF registration with-EOPNOTSUPP. The check inio_register_dmabuf()cannot handle this configuration because its object file is not built.
Quoted 5 lines
Fixes 4bb797852328 ("io_uring/rsrc: add dmabuf backed registered buffers")Reported-by kernelci.org bot <[email protected]>Signed-off-by Sasha Levin <[email protected]>
Thanks, this fixes the build on a variety of my test systems
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
Quoted 6 lines · Sasha Levin
io_register_dmabuf_desc()callsio_register_dmabuf()unconditionally, butio_uring/dma-buf.ois only built withCONFIG_DMA_SHARED_BUFFERenabled. This causes an undefined reference toio_register_dmabuf()when linking kernels withCONFIG_IO_URING=yandCONFIG_DMA_SHARED_BUFFER=n, as reported by KernelCI for i386 allnoconfig and ARChaps_hs_smp_defconfigbuilds.
Quoted 8 lines
Move the configuration check from
io_register_dmabuf()toio_register_dmabuf_desc(), before allocating the resource node and mapped buffer. This lets the compiler eliminate the call when DMA-BUF support is disabled and rejects DMA-BUF registration with-EOPNOTSUPP. The check inio_register_dmabuf()cannot handle this configuration because its object file is not built.[...]
Applied, thanks!
[1/1] io_uring/rsrc: fix build without DMA_SHARED_BUFFER
commit: 1127f017f33d9e9dbbadd1c230a0640f9a326055
Best regards,
Signature · 1 line
Jens Axboe