Re: [PATCH io_uring-next/net-next v2 0/4] implement io_uring notification (ubuf_info) stacking

2024-04-19 Thread Pavel Begunkov
On 4/19/24 12:08, Pavel Begunkov wrote: Please, don't take directly, conflicts with io_uring. When everyone is happy with the patches, Jens and Jakub will hopefully help to merge them. E.g. first staging net/ specific changes [1] and then handling all conflicts on the io_uring side. [1]

[PATCH io_uring-next/net-next v2 2/4] net: add callback for setting a ubuf_info to skb

2024-04-19 Thread Pavel Begunkov
ubuf_info, otherwise we could end up in a situation when the send would not be able to progress. Reviewed-by: Jens Axboe Reviewed-by: David Ahern Signed-off-by: Pavel Begunkov --- include/linux/skbuff.h | 2 ++ net/core/skbuff.c | 20 ++-- 2 files changed, 16 insert

[PATCH io_uring-next/net-next v2 4/4] io_uring/notif: implement notification stacking

2024-04-19 Thread Pavel Begunkov
boe Signed-off-by: Pavel Begunkov --- io_uring/notif.c | 71 +++- io_uring/notif.h | 3 ++ 2 files changed, 67 insertions(+), 7 deletions(-) diff --git a/io_uring/notif.c b/io_uring/notif.c index 26680176335f..d58cdc01e691 100644 --- a/io_uring/noti

[PATCH io_uring-next/net-next v2 0/4] implement io_uring notification (ubuf_info) stacking

2024-04-19 Thread Pavel Begunkov
/notif-stacking-v2 First two patches based on net-next: https://github.com/isilence/linux.git iou-sendzc/notif-stacking-v2-netonly v2: convert xen-netback to ubuf_info_ops (patch 1) drop two separately merged io_uring patches Pavel Begunkov (4): net: extend ubuf_info callback to ops struc

[PATCH io_uring-next/net-next v2 1/4] net: extend ubuf_info callback to ops structure

2024-04-19 Thread Pavel Begunkov
which is currently passed in struct msghdr. Reviewed-by: Jens Axboe Reviewed-by: David Ahern Signed-off-by: Pavel Begunkov --- drivers/net/tap.c | 2 +- drivers/net/tun.c | 2 +- drivers/net/xen-netback/common.h| 5 ++--- drivers/net/xen-netback/interfac

[PATCH io_uring-next/net-next v2 3/4] io_uring/notif: simplify io_notif_flush()

2024-04-19 Thread Pavel Begunkov
io_notif_flush() is partially duplicating io_tx_ubuf_complete(), so instead of duplicating it, make the flush call io_tx_ubuf_complete. Reviewed-by: Jens Axboe Signed-off-by: Pavel Begunkov --- io_uring/notif.c | 6 +++--- io_uring/notif.h | 9 +++-- 2 files changed, 6 insertions(+), 9

Re: [PATCH net-next 0/4] shrink struct ubuf_info

2022-09-27 Thread Pavel Begunkov
On 9/27/22 21:23, Paolo Abeni wrote: On Tue, 2022-09-27 at 21:17 +0100, Pavel Begunkov wrote: On 9/27/22 20:59, Paolo Abeni wrote: On Tue, 2022-09-27 at 19:48 +0100, Pavel Begunkov wrote: On 9/27/22 18:56, Paolo Abeni wrote: On Tue, 2022-09-27 at 18:16 +0100, Pavel Begunkov wrote: On 9/27

Re: [PATCH net-next 0/4] shrink struct ubuf_info

2022-09-27 Thread Pavel Begunkov
On 9/27/22 20:59, Paolo Abeni wrote: On Tue, 2022-09-27 at 19:48 +0100, Pavel Begunkov wrote: On 9/27/22 18:56, Paolo Abeni wrote: On Tue, 2022-09-27 at 18:16 +0100, Pavel Begunkov wrote: On 9/27/22 15:28, Pavel Begunkov wrote: Hello Paolo, On 9/27/22 14:49, Paolo Abeni wrote: Hello, On

Re: [PATCH net-next 0/4] shrink struct ubuf_info

2022-09-27 Thread Pavel Begunkov
On 9/27/22 18:56, Paolo Abeni wrote: On Tue, 2022-09-27 at 18:16 +0100, Pavel Begunkov wrote: On 9/27/22 15:28, Pavel Begunkov wrote: Hello Paolo, On 9/27/22 14:49, Paolo Abeni wrote: Hello, On Fri, 2022-09-23 at 17:39 +0100, Pavel Begunkov wrote: struct ubuf_info is large but not all

Re: [PATCH net-next 0/4] shrink struct ubuf_info

2022-09-27 Thread Pavel Begunkov
On 9/27/22 15:28, Pavel Begunkov wrote: Hello Paolo, On 9/27/22 14:49, Paolo Abeni wrote: Hello, On Fri, 2022-09-23 at 17:39 +0100, Pavel Begunkov wrote: struct ubuf_info is large but not all fields are needed for all cases. We have limited space in io_uring for it and large ubuf_info

Re: [PATCH net-next 0/4] shrink struct ubuf_info

2022-09-27 Thread Pavel Begunkov
Hello Paolo, On 9/27/22 14:49, Paolo Abeni wrote: Hello, On Fri, 2022-09-23 at 17:39 +0100, Pavel Begunkov wrote: struct ubuf_info is large but not all fields are needed for all cases. We have limited space in io_uring for it and large ubuf_info prevents some struct embedding, even though we

[PATCH net-next 1/4] net: introduce struct ubuf_info_msgzc

2022-09-23 Thread Pavel Begunkov
tches. Signed-off-by: Pavel Begunkov --- include/linux/skbuff.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index f15d5b62539b..fd7dcb977fdf 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -554,7 +5

[PATCH net-next 3/4] vhost/net: use struct ubuf_info_msgzc

2022-09-23 Thread Pavel Begunkov
struct ubuf_info will be changed, use ubuf_info_msgzc instead. Signed-off-by: Pavel Begunkov --- drivers/vhost/net.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 68e4ecd1cc0e..d7a04d573988 100644 --- a

[PATCH net-next 2/4] xen/netback: use struct ubuf_info_msgzc

2022-09-23 Thread Pavel Begunkov
struct ubuf_info will be changed, use ubuf_info_msgzc instead. Signed-off-by: Pavel Begunkov --- drivers/net/xen-netback/common.h| 2 +- drivers/net/xen-netback/interface.c | 4 ++-- drivers/net/xen-netback/netback.c | 7 --- 3 files changed, 7 insertions(+), 6 deletions(-) diff

[PATCH net-next 0/4] shrink struct ubuf_info

2022-09-23 Thread Pavel Begunkov
ning on top by creating new structs containing ubuf_info but with proper types. Pavel Begunkov (4): net: introduce struct ubuf_info_msgzc xen/netback: use struct ubuf_info_msgzc vhost/net: use struct ubuf_info_msgzc net: shrink struct ubuf_info drivers/net/xen-netback/common.h| 2 +- d

[PATCH net-next 4/4] net: shrink struct ubuf_info

2022-09-23 Thread Pavel Begunkov
We can benefit from a smaller struct ubuf_info, so leave only mandatory fields and let users to decide how they want to extend it. Convert MSG_ZEROCOPY to struct ubuf_info_msgzc and remove duplicated fields. This reduces the size from 48 bytes to just 16. Signed-off-by: Pavel Begunkov

[RFC net-next io_uring 07/11] net/tcp: optimise tcp ubuf refcounting

2022-08-11 Thread Pavel Begunkov
Add UARGFL_CALLER_PINNED letting protocols know that the caller holds a reference to the ubuf_info and so it doesn't need additional refcounting for purposes of keeping it alive. With that TCP can save a refcount put/get pair per send when used with ->msg_ubuf. Signed-off-by: Pavel

[RFC net-next io_uring 04/11] net: shrink struct ubuf_info

2022-08-11 Thread Pavel Begunkov
We can benefit from a smaller struct ubuf_info, so leave only mandatory fields and let users to decide how they want to extend it. Convert MSG_ZEROCOPY to struct ubuf_info_msgzc and remove duplicated fields. This reduces the size from 48 bytes to just 16. Signed-off-by: Pavel Begunkov

[RFC net-next io_uring 10/11] io_uring/notif: mark notifs with UARGFL_CALLER_PINNED

2022-08-11 Thread Pavel Begunkov
We always keep references to active notifications and drop them only when we flush, so they're always pinned during sock_sendmsg() and we can add UARGFL_CALLER_PINNED. Signed-off-by: Pavel Begunkov --- io_uring/notif.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/io_

[RFC net-next io_uring 09/11] io_uring/notif: add helper for flushing refs

2022-08-11 Thread Pavel Begunkov
Add a helper for dropping notification references during flush. It's a preparation patch, currently it's only one master ref, but we're going to add ref caching. Signed-off-by: Pavel Begunkov --- io_uring/notif.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-

[RFC net-next io_uring 11/11] io_uring/notif: add ubuf_info ref caching

2022-08-11 Thread Pavel Begunkov
Cache some active notifier references at the io_uring side and get them in batches, so the ammortised cost is low. Then these references can be given away to the network layer using UARGFL_GIFT_REF. Signed-off-by: Pavel Begunkov --- io_uring/net.c | 8 +++- io_uring/notif.c | 6

[RFC net-next io_uring 01/11] net: introduce struct ubuf_info_msgzc

2022-08-11 Thread Pavel Begunkov
tches. Signed-off-by: Pavel Begunkov --- include/linux/skbuff.h | 21 + 1 file changed, 21 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index ca8afa382bf2..f8ac3678dab8 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -554,7 +5

[RFC net-next io_uring 06/11] net: add flags for controlling ubuf_info

2022-08-11 Thread Pavel Begunkov
There are already skb_flags in ubuf_info, which enhancing skbs. Also add flags controlling ubuf_info, mainly to hint about various referencing aspects of it, which will be introduced in later patches. Signed-off-by: Pavel Begunkov --- include/linux/skbuff.h | 1 + io_uring/notif.c | 1

[RFC net-next io_uring 05/11] net: rename ubuf_info's flags

2022-08-11 Thread Pavel Begunkov
ubuf_info::flags contains SKBFL_* flags that we copy into skbs, change the field name to stress that it keeps skb flags. Signed-off-by: Pavel Begunkov --- include/linux/skbuff.h | 4 ++-- io_uring/notif.c | 2 +- net/core/skbuff.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions

[RFC net-next io_uring 02/11] xen/netback: use struct ubuf_info_msgzc

2022-08-11 Thread Pavel Begunkov
struct ubuf_info will be changed, use ubuf_info_msgzc instead. Signed-off-by: Pavel Begunkov --- drivers/net/xen-netback/common.h| 2 +- drivers/net/xen-netback/interface.c | 4 ++-- drivers/net/xen-netback/netback.c | 7 --- 3 files changed, 7 insertions(+), 6 deletions(-) diff

[RFC net-next io_uring 03/11] vhost/net: use struct ubuf_info_msgzc

2022-08-11 Thread Pavel Begunkov
struct ubuf_info will be changed, use ubuf_info_msgzc instead. Signed-off-by: Pavel Begunkov --- drivers/vhost/net.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 68e4ecd1cc0e..9b616536dd9e 100644 --- a

[RFC net-next io_uring 08/11] net: let callers provide ->msg_ubuf refs

2022-08-11 Thread Pavel Begunkov
network decides to take the ref it should clear the flag. Signed-off-by: Pavel Begunkov --- include/linux/skbuff.h | 14 ++ net/ipv4/ip_output.c | 1 + net/ipv6/ip6_output.c | 1 + 3 files changed, 16 insertions(+) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h

[RFC net-next io_uring 00/11] improve io_uring's ubuf_info refcounting

2022-08-11 Thread Pavel Begunkov
patchset and some more [1] showed ~1.6% qps improvement for UDP (dummy dev), and ~1% for TCP (localhost + hacks enabling zc). I didn't specifically test xen and vhost and not sure how, would love some help with that. [1] https://github.com/isilence/linux/tree/net/zc-ref-optimisation Pav