public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf
@ 2025-05-06 16:08 Pavel Begunkov
  2025-05-06 16:10 ` Pavel Begunkov
  2025-05-06 16:58 ` Alexey Charkov
  0 siblings, 2 replies; 5+ messages in thread
From: Pavel Begunkov @ 2025-05-06 16:08 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, Alexey Charkov

armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
`io_release_dmabuf':
zcrx.c:(.text+0x1c): undefined reference to `dma_buf_unmap_attachment_unlocked'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x30): undefined
reference to `dma_buf_detach'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x40): undefined
reference to `dma_buf_put'
armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
`io_register_zcrx_ifq':
zcrx.c:(.text+0x15cc): undefined reference to `dma_buf_get'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x15e8): undefined
reference to `dma_buf_attach'
armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x1604): undefined
reference to `dma_buf_map_attachment_unlocked'
make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
make[1]: *** [/home/alchark/linux/Makefile:1242: vmlinux] Error 2
make: *** [Makefile:248: __sub-make] Error 2

There are no definitions for dma-buf functions without
CONFIG_DMA_SHARED_BUFFER, make sure we don't try to link to them
if dma-bufs are not enabled.

Reported-by: Alexey Charkov <alchark@gmail.com>
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 io_uring/zcrx.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index fac293bcba72..9a568d049204 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -49,6 +49,9 @@ static inline struct page *io_zcrx_iov_page(const struct net_iov *niov)
 
 static void io_release_dmabuf(struct io_zcrx_mem *mem)
 {
+	if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+		return;
+
 	if (mem->sgt)
 		dma_buf_unmap_attachment_unlocked(mem->attach, mem->sgt,
 						  DMA_FROM_DEVICE);
@@ -75,6 +78,8 @@ static int io_import_dmabuf(struct io_zcrx_ifq *ifq,
 
 	if (WARN_ON_ONCE(!ifq->dev))
 		return -EFAULT;
+	if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+		return -EINVAL;
 
 	mem->is_dmabuf = true;
 	mem->dmabuf = dma_buf_get(dmabuf_fd);
@@ -118,6 +123,9 @@ static int io_zcrx_map_area_dmabuf(struct io_zcrx_ifq *ifq, struct io_zcrx_area
 	struct scatterlist *sg;
 	unsigned i, niov_idx = 0;
 
+	if (!IS_ENABLED(CONFIG_DMA_SHARED_BUFFER))
+		return -EINVAL;
+
 	for_each_sgtable_dma_sg(area->mem.sgt, sg, i) {
 		dma_addr_t dma = sg_dma_address(sg);
 		unsigned long sg_len = sg_dma_len(sg);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf
  2025-05-06 16:08 [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf Pavel Begunkov
@ 2025-05-06 16:10 ` Pavel Begunkov
  2025-05-06 16:11   ` Jens Axboe
  2025-05-06 16:58 ` Alexey Charkov
  1 sibling, 1 reply; 5+ messages in thread
From: Pavel Begunkov @ 2025-05-06 16:10 UTC (permalink / raw)
  To: io-uring; +Cc: Alexey Charkov

On 5/6/25 17:08, Pavel Begunkov wrote:
> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
> `io_release_dmabuf':
> zcrx.c:(.text+0x1c): undefined reference to `dma_buf_unmap_attachment_unlocked'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x30): undefined
> reference to `dma_buf_detach'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x40): undefined
> reference to `dma_buf_put'
> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
> `io_register_zcrx_ifq':
> zcrx.c:(.text+0x15cc): undefined reference to `dma_buf_get'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x15e8): undefined
> reference to `dma_buf_attach'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x1604): undefined
> reference to `dma_buf_map_attachment_unlocked'
> make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
> make[1]: *** [/home/alchark/linux/Makefile:1242: vmlinux] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
> 
> There are no definitions for dma-buf functions without
> CONFIG_DMA_SHARED_BUFFER, make sure we don't try to link to them
> if dma-bufs are not enabled.

Jens, you'd probably want to squash it into a42c735833315bbe7a54
("io_uring/zcrx: dmabuf backed zerocopy receive")

-- 
Pavel Begunkov


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf
  2025-05-06 16:10 ` Pavel Begunkov
@ 2025-05-06 16:11   ` Jens Axboe
  0 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2025-05-06 16:11 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: Alexey Charkov

On 5/6/25 10:10 AM, Pavel Begunkov wrote:
> On 5/6/25 17:08, Pavel Begunkov wrote:
>> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
>> `io_release_dmabuf':
>> zcrx.c:(.text+0x1c): undefined reference to `dma_buf_unmap_attachment_unlocked'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x30): undefined
>> reference to `dma_buf_detach'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x40): undefined
>> reference to `dma_buf_put'
>> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
>> `io_register_zcrx_ifq':
>> zcrx.c:(.text+0x15cc): undefined reference to `dma_buf_get'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x15e8): undefined
>> reference to `dma_buf_attach'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x1604): undefined
>> reference to `dma_buf_map_attachment_unlocked'
>> make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
>> make[1]: *** [/home/alchark/linux/Makefile:1242: vmlinux] Error 2
>> make: *** [Makefile:248: __sub-make] Error 2
>>
>> There are no definitions for dma-buf functions without
>> CONFIG_DMA_SHARED_BUFFER, make sure we don't try to link to them
>> if dma-bufs are not enabled.
> 
> Jens, you'd probably want to squash it into a42c735833315bbe7a54
> ("io_uring/zcrx: dmabuf backed zerocopy receive")

Done, added the new link too.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf
  2025-05-06 16:08 [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf Pavel Begunkov
  2025-05-06 16:10 ` Pavel Begunkov
@ 2025-05-06 16:58 ` Alexey Charkov
  2025-05-07  7:35   ` Pavel Begunkov
  1 sibling, 1 reply; 5+ messages in thread
From: Alexey Charkov @ 2025-05-06 16:58 UTC (permalink / raw)
  To: Pavel Begunkov; +Cc: io-uring

On Tue, May 6, 2025 at 8:07 PM Pavel Begunkov <asml.silence@gmail.com> wrote:
>
> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
> `io_release_dmabuf':
> zcrx.c:(.text+0x1c): undefined reference to `dma_buf_unmap_attachment_unlocked'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x30): undefined
> reference to `dma_buf_detach'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x40): undefined
> reference to `dma_buf_put'
> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
> `io_register_zcrx_ifq':
> zcrx.c:(.text+0x15cc): undefined reference to `dma_buf_get'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x15e8): undefined
> reference to `dma_buf_attach'
> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x1604): undefined
> reference to `dma_buf_map_attachment_unlocked'
> make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
> make[1]: *** [/home/alchark/linux/Makefile:1242: vmlinux] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>
> There are no definitions for dma-buf functions without
> CONFIG_DMA_SHARED_BUFFER, make sure we don't try to link to them
> if dma-bufs are not enabled.
>
> Reported-by: Alexey Charkov <alchark@gmail.com>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
> ---
>  io_uring/zcrx.c | 8 ++++++++
>  1 file changed, 8 insertions(+)

Just wanted to confirm that this fixes the build in my setup, thanks a
lot Pavel!

Best regards,
Alexey

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf
  2025-05-06 16:58 ` Alexey Charkov
@ 2025-05-07  7:35   ` Pavel Begunkov
  0 siblings, 0 replies; 5+ messages in thread
From: Pavel Begunkov @ 2025-05-07  7:35 UTC (permalink / raw)
  To: Alexey Charkov; +Cc: io-uring

On 5/6/25 17:58, Alexey Charkov wrote:
> On Tue, May 6, 2025 at 8:07 PM Pavel Begunkov <asml.silence@gmail.com> wrote:
>>
>> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
>> `io_release_dmabuf':
>> zcrx.c:(.text+0x1c): undefined reference to `dma_buf_unmap_attachment_unlocked'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x30): undefined
>> reference to `dma_buf_detach'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x40): undefined
>> reference to `dma_buf_put'
>> armv7a-unknown-linux-gnueabihf-ld: io_uring/zcrx.o: in function
>> `io_register_zcrx_ifq':
>> zcrx.c:(.text+0x15cc): undefined reference to `dma_buf_get'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x15e8): undefined
>> reference to `dma_buf_attach'
>> armv7a-unknown-linux-gnueabihf-ld: zcrx.c:(.text+0x1604): undefined
>> reference to `dma_buf_map_attachment_unlocked'
>> make[2]: *** [scripts/Makefile.vmlinux:91: vmlinux] Error 1
>> make[1]: *** [/home/alchark/linux/Makefile:1242: vmlinux] Error 2
>> make: *** [Makefile:248: __sub-make] Error 2
>>
>> There are no definitions for dma-buf functions without
>> CONFIG_DMA_SHARED_BUFFER, make sure we don't try to link to them
>> if dma-bufs are not enabled.
>>
>> Reported-by: Alexey Charkov <alchark@gmail.com>
>> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
>> ---
>>   io_uring/zcrx.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
> 
> Just wanted to confirm that this fixes the build in my setup, thanks a
> lot Pavel!

Thanks for double checking!

-- 
Pavel Begunkov


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-07  7:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-06 16:08 [PATCH 1/1] io_uring/zcrx: fix builds without dmabuf Pavel Begunkov
2025-05-06 16:10 ` Pavel Begunkov
2025-05-06 16:11   ` Jens Axboe
2025-05-06 16:58 ` Alexey Charkov
2025-05-07  7:35   ` Pavel Begunkov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox