udp:allow UDP cmsghdrs through io_uring
Subsystems (4)
PATCH v5 1/1 udp:allow UDP cmsghdrs through io_uring
This patch adds PROTO_CMSG_DATA_ONLY to inet_dgram_ops and inet6_dgram_ops so that UDP_SEGMENT (GSO) and UDP_GRO can be used through io_uring.
GSO and GRO are vital to bring QUIC servers on par with TCP throughputs, and together offer a higher throughput gain than io_uring alone (rate of data transit
considering), thus io_uring is presently the lesser performance choice.
RE http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf,
GSO is about +~63% and GRO +~82%.
this patch closes that loophole.
--- net/ipv4/af_inet.c | 1 + net/ipv6/af_inet6.c | 1 + net/socket.c | 8 +++++--- 3 files changed, 7 insertions(+), 3 deletions(-)
net/ipv4/af_inet.c +1 -0
@@ -1052,6 +1052,7 @@ EXPORT_SYMBOL(inet_stream_ops);const struct proto_ops inet_dgram_ops = { .family =PF_INET , + .flags =PROTO_CMSG_DATA_ONLY , .owner =THIS_MODULE , .release = inet_release, .bind = inet_bind,
net/ipv6/af_inet6.c +1 -0
@@ -695,6 +695,7 @@ const struct proto_ops inet6_stream_ops = {const struct proto_ops inet6_dgram_ops = { .family =PF_INET6 , + .flags =PROTO_CMSG_DATA_ONLY , .owner =THIS_MODULE , .release = inet6_release, .bind = inet6_bind,
net/socket.c +5 -3
@@ -2416,9 +2416,11 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,long __sys_sendmsg_sock (struct socket *sock,struct msghdr *msg,unsigned int flags) { -/* disallow ancillary data requests from this path */ -if (msg->msg_control || msg->msg_controllen) -return -EINVAL ; +if (msg->msg_control || msg->msg_controllen) { +/* disallow ancillary data reqs unless cmsg is plain data */ +if (!(sock->ops->flags &PROTO_CMSG_DATA_ONLY )) +return -EINVAL ; + }return ____sys_sendmsg (sock, msg, flags,NULL ,0 ); }
Signature · 1 line
2.26.2
Quoted 7 lines · Victor Stewart
This patch adds
PROTO_CMSG_DATA_ONLYtoinet_dgram_opsandinet6_dgram_opsso thatUDP_SEGMENT(GSO) andUDP_GROcan be used throughio_uring.GSO and GRO are vital to bring QUIC servers on par with TCP throughputs, and together offer a higher throughput gain than
io_uringalone (rate of data transit
considering), thusio_uringis presently the lesser performance choice.
Quoted 6 lines
RE http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf,
GSO is about +~63% and GRO +~82%.this patch closes that loophole.
Signed-off-by Victor Stewart <[email protected]>
Thanks for adding this! I audied the code and couldn't find an escalation path. +Jann could you please double check?
Quoted 52 lines
--- net/ipv4/af_inet.c | 1 + net/ipv6/af_inet6.c | 1 + net/socket.c | 8 +++++--- 3 files changed, 7 insertions(+), 3 deletions(-)net/ipv4/af_inet.c +1
-0@@ -1052,6 +1052,7 @@ EXPORT_SYMBOL(inet_stream_ops);const struct proto_ops inet_dgram_ops = { .family =PF_INET , + .flags =PROTO_CMSG_DATA_ONLY , .owner =THIS_MODULE , .release = inet_release, .bind = inet_bind,net/ipv6/af_inet6.c +1
-0@@ -695,6 +695,7 @@ const struct proto_ops inet6_stream_ops = {const struct proto_ops inet6_dgram_ops = { .family =PF_INET6 , + .flags =PROTO_CMSG_DATA_ONLY , .owner =THIS_MODULE , .release = inet6_release, .bind = inet6_bind,net/socket.c +5
-4@@ -2416,9 +2416,11 @@ static int ___sys_sendmsg(struct socket *sock, struct user_msghdr __user *msg,long __sys_sendmsg_sock (struct socket *sock,struct msghdr *msg,unsigned int flags) { -/* disallow ancillary data requests from this path */ -if (msg->msg_control || msg->msg_controllen) -return -EINVAL ; +if (msg->msg_control || msg->msg_controllen) { +/* disallow ancillary data reqs unless cmsg is plain data */ +if (!(sock->ops->flags &PROTO_CMSG_DATA_ONLY )) +return -EINVAL ; + }return ____sys_sendmsg (sock, msg, flags,NULL ,0 ); } --2.26.2
Quoted 10 lines · Victor Stewart
This patch adds
PROTO_CMSG_DATA_ONLYtoinet_dgram_opsandinet6_dgram_opsso thatUDP_SEGMENT(GSO) andUDP_GROcan be used throughio_uring.GSO and GRO are vital to bring QUIC servers on par with TCP throughputs, and together offer a higher throughput gain than
io_uringalone (rate of data transit
considering), thusio_uringis presently the lesser performance choice.RE http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf,
GSO is about +~63% and GRO +~82%.this patch closes that loophole.
LGTM
Signature · 1 line
Jens Axboe
might this still make it into 5.11?
Quoted 20 lines · Jens Axboe
Quoted 10 lines · Victor Stewart
This patch adds
PROTO_CMSG_DATA_ONLYtoinet_dgram_opsandinet6_dgram_opsso thatUDP_SEGMENT(GSO) andUDP_GROcan be used throughio_uring.GSO and GRO are vital to bring QUIC servers on par with TCP throughputs, and together offer a higher throughput gain than
io_uringalone (rate of data transit
considering), thusio_uringis presently the lesser performance choice.RE http://vger.kernel.org/lpc_net2018_talks/willemdebruijn-lpc2018-udpgso-paper-DRAFT-1.pdf,
GSO is about +~63% and GRO +~82%.this patch closes that loophole.
LGTM
Acked-by Jens Axboe <[email protected]>--
Jens Axboe
Jens Axboe
maintainerQuoted 1 line · Victor Stewart
might this still make it into 5.11?
Doesn't meet the criteria to go in at this point. I sometimes make exceptions, but generally speaking, something going into 5.11 should have been completed at least a week ago.
So I'd feel more comfortable pushing this to 5.12.
Signature · 1 line
Jens Axboe
Quoted 9 lines · Jens Axboe
Quoted 1 line · Victor Stewart
might this still make it into 5.11?
Doesn't meet the criteria to go in at this point. I sometimes make exceptions, but generally speaking, something going into 5.11 should have been completed at least a week ago.
So I'd feel more comfortable pushing this to 5.12.
ping. are we still looking at 5.12 for this?
Quoted 4 lines
--
Jens Axboe