Re: [PATCH v1 09/15] io_uring/zcrx: add interface queue and refill queue

Pavel Begunkov
2024-10-09T19:08:18Z

On 10/9/24 18:50, Jens Axboe wrote:
> On 10/7/24 4:15 PM, David Wei wrote:
>> From: David Wei <davidhwei@meta.com>
>>
...
>> diff --git a/io_uring/Makefile b/io_uring/Makefile
>> index 61923e11c767..1a1184f3946a 100644
>> --- a/io_uring/Makefile
>> +++ b/io_uring/Makefile
>> @@ -10,6 +10,7 @@ obj-$(CONFIG_IO_URING) += io_uring.o opdef.o kbuf.o rsrc.o notif.o \
>> epoll.o statx.o timeout.o fdinfo.o \
>> cancel.o waitid.o register.o \
>> truncate.o memmap.o
>> +obj-$(CONFIG_PAGE_POOL) += zcrx.o
>> obj-$(CONFIG_IO_WQ) += io-wq.o
>> obj-$(CONFIG_FUTEX) += futex.o
>> obj-$(CONFIG_NET_RX_BUSY_POLL) += napi.o
>
> I wonder if this should be expressed a bit differently. Probably have a
> CONFIG_IO_URING_ZCRX which depends on CONFIG_INET and CONFIG_PAGE_POOL.
> And then you can also use that rather than doing:
>
> #if defined(CONFIG_PAGE_POOL) && defined(CONFIG_INET)
>
> in some spots. Not a big deal, it'll work as-is. And honestly should
> probably cleanup the existing IO_WQ symbol while at it, so perhaps
> better left for after the fact.

I should probably just add not selectable by user
CONFIG_IO_URING_ZCRX and make it depend on INET/etc.

>> +static int io_allocate_rbuf_ring(struct io_zcrx_ifq *ifq,
>> + struct io_uring_zcrx_ifq_reg *reg)
>> +{
>> + size_t off, size;
>> + void *ptr;
>> +
>> + off = sizeof(struct io_uring);
>> + size = off + sizeof(struct io_uring_zcrx_rqe) * reg->rq_entries;
>> +
>> + ptr = io_pages_map(&ifq->rqe_pages, &ifq->n_rqe_pages, size);
>> + if (IS_ERR(ptr))
>> + return PTR_ERR(ptr);
>> +
>> + ifq->rq_ring = (struct io_uring *)ptr;
>> + ifq->rqes = (struct io_uring_zcrx_rqe *)((char *)ptr + off);
>> + return 0;
>> +}
>
> No need to cast that ptr to char *.

I'll apply it and other small nits, thanks for the review

--
Pavel Begunkov