All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alvaro Karsz <alvaro.karsz@solid-run.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"virtualization@lists.linux-foundation.org"
	<virtualization@lists.linux-foundation.org>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCH net] virtio-net: reject small vring sizes
Date: Mon, 17 Apr 2023 05:20:09 -0400	[thread overview]
Message-ID: <20230417051816-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <AM0PR04MB4723F3E6AE381AEC36D1AEFED49C9@AM0PR04MB4723.eurprd04.prod.outlook.com>

On Mon, Apr 17, 2023 at 07:33:58AM +0000, Alvaro Karsz wrote:
> > > > > > Actually, I think that all you need to do is disable NETIF_F_SG,
> > > > > > and things will work, no?
> > > > >
> > > > > I think that this is not so simple, if I understand correctly, by disabling NETIF_F_SG we will never receive a chained skbs to transmit, but we still have more functionality to address, for example:
> > > > > * The TX timeouts.
> > > >
> > > > I don't get it. With a linear skb we can transmit it as long as there's
> > > > space for 2 entries in the vq: header and data. What's the source of the
> > > > timeouts?
> > > >
> > >
> > > I'm not saying that this is not possible, I meant that we need more changes to virtio-net.
> > > The source of the timeouts is from the current implementation of virtnet_poll_tx.
> > >
> > > if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
> > >       netif_tx_wake_queue(txq);
> > 
> > Oh right. So this should check NETIF_F_SG then.
> > BTW both ring size and s/g can be tweaked by ethtool, also
> > needs handling.
> > 
> 
> Good point.
> 
> > >
> > > > > * Guest GSO/big MTU (without VIRTIO_NET_F_MRG_RXBUF?), we can't chain page size buffers anymore.
> > > >
> > > > I think we can.  mergeable_min_buf_len will just be large.
> > > >
> > >
> > > I meant that we can't just by clearing NETIF_F_SG, we'll need to change virtio-net a little bit more, for example, the virtnet_set_big_packets function.
> > >
> > 
> > Right - for RX, big_packets_num_skbfrags ignores ring size and that's
> > probably a bug if mtu is very large.
> > 
> 
> So, what do you think, we should fix virtio-net to work with smaller rings? we should fail probe?
> 
> I think that since this never came up until now, there is no big demand to such small rings.

The worry is that once we start failing probe there's just a tiny chance
hosts begin to rely on us failing probe then we won't be able to fix it.
So it depends on the size of the patch I think. So far it seems small enough
that wasting code on failing probe isn't worth it.

-- 
MST

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Alvaro Karsz <alvaro.karsz@solid-run.com>
Cc: Jason Wang <jasowang@redhat.com>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"edumazet@google.com" <edumazet@google.com>,
	"kuba@kernel.org" <kuba@kernel.org>,
	"pabeni@redhat.com" <pabeni@redhat.com>,
	"virtualization@lists.linux-foundation.org" 
	<virtualization@lists.linux-foundation.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] virtio-net: reject small vring sizes
Date: Mon, 17 Apr 2023 05:20:09 -0400	[thread overview]
Message-ID: <20230417051816-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <AM0PR04MB4723F3E6AE381AEC36D1AEFED49C9@AM0PR04MB4723.eurprd04.prod.outlook.com>

On Mon, Apr 17, 2023 at 07:33:58AM +0000, Alvaro Karsz wrote:
> > > > > > Actually, I think that all you need to do is disable NETIF_F_SG,
> > > > > > and things will work, no?
> > > > >
> > > > > I think that this is not so simple, if I understand correctly, by disabling NETIF_F_SG we will never receive a chained skbs to transmit, but we still have more functionality to address, for example:
> > > > > * The TX timeouts.
> > > >
> > > > I don't get it. With a linear skb we can transmit it as long as there's
> > > > space for 2 entries in the vq: header and data. What's the source of the
> > > > timeouts?
> > > >
> > >
> > > I'm not saying that this is not possible, I meant that we need more changes to virtio-net.
> > > The source of the timeouts is from the current implementation of virtnet_poll_tx.
> > >
> > > if (sq->vq->num_free >= 2 + MAX_SKB_FRAGS)
> > >       netif_tx_wake_queue(txq);
> > 
> > Oh right. So this should check NETIF_F_SG then.
> > BTW both ring size and s/g can be tweaked by ethtool, also
> > needs handling.
> > 
> 
> Good point.
> 
> > >
> > > > > * Guest GSO/big MTU (without VIRTIO_NET_F_MRG_RXBUF?), we can't chain page size buffers anymore.
> > > >
> > > > I think we can.  mergeable_min_buf_len will just be large.
> > > >
> > >
> > > I meant that we can't just by clearing NETIF_F_SG, we'll need to change virtio-net a little bit more, for example, the virtnet_set_big_packets function.
> > >
> > 
> > Right - for RX, big_packets_num_skbfrags ignores ring size and that's
> > probably a bug if mtu is very large.
> > 
> 
> So, what do you think, we should fix virtio-net to work with smaller rings? we should fail probe?
> 
> I think that since this never came up until now, there is no big demand to such small rings.

The worry is that once we start failing probe there's just a tiny chance
hosts begin to rely on us failing probe then we won't be able to fix it.
So it depends on the size of the patch I think. So far it seems small enough
that wasting code on failing probe isn't worth it.

-- 
MST


  reply	other threads:[~2023-04-17  9:20 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-16  7:46 [PATCH net] virtio-net: reject small vring sizes Alvaro Karsz
2023-04-16  7:46 ` Alvaro Karsz
2023-04-16 16:54 ` Alvaro Karsz
2023-04-16 16:54   ` Alvaro Karsz
2023-04-16 20:45   ` Michael S. Tsirkin
2023-04-16 20:45     ` Michael S. Tsirkin
2023-04-17  3:24     ` Jason Wang
2023-04-17  3:24       ` Jason Wang
2023-04-17  6:20       ` Michael S. Tsirkin
2023-04-17  6:20         ` Michael S. Tsirkin
2023-04-17  6:38         ` Alvaro Karsz
2023-04-17  6:38           ` Alvaro Karsz
2023-04-17  6:41           ` Michael S. Tsirkin
2023-04-17  6:41             ` Michael S. Tsirkin
2023-04-17  7:03             ` Alvaro Karsz
2023-04-17  7:03               ` Alvaro Karsz
2023-04-17  7:10               ` Michael S. Tsirkin
2023-04-17  7:10                 ` Michael S. Tsirkin
2023-04-17  7:33                 ` Alvaro Karsz
2023-04-17  7:33                   ` Alvaro Karsz
2023-04-17  9:20                   ` Michael S. Tsirkin [this message]
2023-04-17  9:20                     ` Michael S. Tsirkin
2023-04-17 10:04                     ` Alvaro Karsz
2023-04-17 10:04                       ` Alvaro Karsz
2023-04-17 11:40                       ` Michael S. Tsirkin
2023-04-17 11:40                         ` Michael S. Tsirkin
2023-04-17 11:51                         ` Alvaro Karsz
2023-04-17 11:51                           ` Alvaro Karsz
2023-04-17 11:57                           ` Michael S. Tsirkin
2023-04-17 11:57                             ` Michael S. Tsirkin
2023-04-23  6:51                             ` Alvaro Karsz
2023-04-23  6:51                               ` Alvaro Karsz
2023-04-23  7:19                               ` Michael S. Tsirkin
2023-04-23  7:19                                 ` Michael S. Tsirkin
2023-04-23  7:52                                 ` Alvaro Karsz
2023-04-23  7:52                                   ` Alvaro Karsz
2023-04-23 11:06                                   ` Michael S. Tsirkin
2023-04-23 11:06                                     ` Michael S. Tsirkin
2023-04-23 12:28                                     ` Alvaro Karsz
2023-04-23 12:28                                       ` Alvaro Karsz
2023-04-23 20:17                                       ` Michael S. Tsirkin
2023-04-23 20:17                                         ` Michael S. Tsirkin
2023-04-25  8:34                                       ` Michael S. Tsirkin
2023-04-25  8:34                                         ` Michael S. Tsirkin
2023-04-25  9:41                                         ` Alvaro Karsz
2023-04-25  9:41                                           ` Alvaro Karsz
2023-04-25 11:11                                           ` Alvaro Karsz
2023-04-25 11:11                                             ` Alvaro Karsz
2023-04-25 12:33                                             ` Michael S. Tsirkin
2023-04-25 12:33                                               ` Michael S. Tsirkin
2023-04-25 12:31                                           ` Michael S. Tsirkin
2023-04-25 12:31                                             ` Michael S. Tsirkin
2023-04-25 13:02                                             ` Alvaro Karsz
2023-04-25 13:02                                               ` Alvaro Karsz
2023-04-25 13:08                                               ` Michael S. Tsirkin
2023-04-25 13:08                                                 ` Michael S. Tsirkin
2023-04-23  8:01                                 ` Alvaro Karsz
2023-04-23  8:01                                   ` Alvaro Karsz
2023-04-23 11:08                                   ` Michael S. Tsirkin
2023-04-23 11:08                                     ` Michael S. Tsirkin
2023-04-17  6:44           ` Xuan Zhuo
2023-04-17  6:44             ` Xuan Zhuo
2023-04-17  7:07             ` Alvaro Karsz
2023-04-17  7:07               ` Alvaro Karsz
2023-04-17  7:11               ` Michael S. Tsirkin
2023-04-17  7:11                 ` Michael S. Tsirkin
2023-04-16 20:38 ` Michael S. Tsirkin
2023-04-16 20:38   ` Michael S. Tsirkin
2023-04-17  6:43   ` Alvaro Karsz
2023-04-17  6:43     ` Alvaro Karsz
2023-04-23 11:09     ` Michael S. Tsirkin
2023-04-23 11:09       ` Michael S. Tsirkin
2023-04-17  1:53 ` Xuan Zhuo
2023-04-17  1:53   ` Xuan Zhuo
2023-04-17  6:47   ` Alvaro Karsz
2023-04-17  6:47     ` Alvaro Karsz
2023-04-17  3:34 ` Xuan Zhuo
2023-04-17  3:34   ` Xuan Zhuo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230417051816-mutt-send-email-mst@kernel.org \
    --to=mst@redhat.com \
    --cc=alvaro.karsz@solid-run.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.