public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring
@ 2020-12-16 22:56 Victor Stewart
  2020-12-16 22:57 ` Soheil Hassas Yeganeh
  2020-12-17 15:49 ` Jens Axboe
  0 siblings, 2 replies; 6+ messages in thread
From: Victor Stewart @ 2020-12-16 22:56 UTC (permalink / raw)
  To: io-uring, soheil, netdev; +Cc: Victor Stewart

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.

Signed-off-by: Victor Stewart <[email protected]>
---
 net/ipv4/af_inet.c  | 1 +
 net/ipv6/af_inet6.c | 1 +
 net/socket.c        | 8 +++++---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index b7260c8cef2e..c9fd5e7cfd6e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -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,
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index e648fbebb167..560f45009d06 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -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,
diff --git a/net/socket.c b/net/socket.c
index 6e6cccc2104f..6995835d6355 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -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


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

* Re: [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring
  2020-12-16 22:56 [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring Victor Stewart
@ 2020-12-16 22:57 ` Soheil Hassas Yeganeh
  2020-12-17 15:49 ` Jens Axboe
  1 sibling, 0 replies; 6+ messages in thread
From: Soheil Hassas Yeganeh @ 2020-12-16 22:57 UTC (permalink / raw)
  To: Victor Stewart; +Cc: io-uring, netdev, Jann Horn

On Wed, Dec 16, 2020 at 5:56 PM Victor Stewart <[email protected]> wrote:
>
> 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.
>
> Signed-off-by: Victor Stewart <[email protected]>

Acked-by: Soheil Hassas Yeganeh <[email protected]>

Thanks for adding this! I audied the code and couldn't find an
escalation path.  +Jann could you please double check?

> ---
>  net/ipv4/af_inet.c  | 1 +
>  net/ipv6/af_inet6.c | 1 +
>  net/socket.c        | 8 +++++---
>  3 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
> index b7260c8cef2e..c9fd5e7cfd6e 100644
> --- a/net/ipv4/af_inet.c
> +++ b/net/ipv4/af_inet.c
> @@ -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,
> diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
> index e648fbebb167..560f45009d06 100644
> --- a/net/ipv6/af_inet6.c
> +++ b/net/ipv6/af_inet6.c
> @@ -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,
> diff --git a/net/socket.c b/net/socket.c
> index 6e6cccc2104f..6995835d6355 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -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
>

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

* Re: [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring
  2020-12-16 22:56 [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring Victor Stewart
  2020-12-16 22:57 ` Soheil Hassas Yeganeh
@ 2020-12-17 15:49 ` Jens Axboe
  2020-12-17 18:30   ` Victor Stewart
  1 sibling, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-12-17 15:49 UTC (permalink / raw)
  To: Victor Stewart, io-uring, soheil, netdev

On 12/16/20 3:56 PM, Victor Stewart wrote:
> 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.

LGTM

Acked-by: Jens Axboe <[email protected]>

-- 
Jens Axboe


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

* Re: [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring
  2020-12-17 15:49 ` Jens Axboe
@ 2020-12-17 18:30   ` Victor Stewart
  2020-12-17 18:45     ` Jens Axboe
  0 siblings, 1 reply; 6+ messages in thread
From: Victor Stewart @ 2020-12-17 18:30 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Soheil Hassas Yeganeh, netdev

might this still make it into 5.11?

On Thu, Dec 17, 2020 at 3:49 PM Jens Axboe <[email protected]> wrote:
>
> On 12/16/20 3:56 PM, Victor Stewart wrote:
> > 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.
>
> LGTM
>
> Acked-by: Jens Axboe <[email protected]>
>
> --
> Jens Axboe
>

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

* Re: [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring
  2020-12-17 18:30   ` Victor Stewart
@ 2020-12-17 18:45     ` Jens Axboe
  2021-02-17 23:44       ` Victor Stewart
  0 siblings, 1 reply; 6+ messages in thread
From: Jens Axboe @ 2020-12-17 18:45 UTC (permalink / raw)
  To: Victor Stewart; +Cc: io-uring, Soheil Hassas Yeganeh, netdev

On 12/17/20 11:30 AM, Victor Stewart wrote:
> 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.

-- 
Jens Axboe


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

* Re: [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring
  2020-12-17 18:45     ` Jens Axboe
@ 2021-02-17 23:44       ` Victor Stewart
  0 siblings, 0 replies; 6+ messages in thread
From: Victor Stewart @ 2021-02-17 23:44 UTC (permalink / raw)
  To: Jens Axboe; +Cc: io-uring, Soheil Hassas Yeganeh, netdev

On Thu, Dec 17, 2020 at 1:45 PM Jens Axboe <[email protected]> wrote:
>
> On 12/17/20 11:30 AM, Victor Stewart wrote:
> > 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?

>
> --
> Jens Axboe
>

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

end of thread, other threads:[~2021-02-17 23:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-12-16 22:56 [PATCH net-next v5] udp:allow UDP cmsghdrs through io_uring Victor Stewart
2020-12-16 22:57 ` Soheil Hassas Yeganeh
2020-12-17 15:49 ` Jens Axboe
2020-12-17 18:30   ` Victor Stewart
2020-12-17 18:45     ` Jens Axboe
2021-02-17 23:44       ` Victor Stewart

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