public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat•com>
To: Alvaro Karsz <alvaro.karsz@solid-run•com>
Cc: "jasowang@redhat•com" <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: Sun, 23 Apr 2023 07:09:33 -0400	[thread overview]
Message-ID: <20230423070849-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <AM0PR04MB4723F658DCBF66632A74592BD49C9@AM0PR04MB4723.eurprd04.prod.outlook.com>

On Mon, Apr 17, 2023 at 06:43:39AM +0000, Alvaro Karsz wrote:
> > > +static int virtnet_validate_vqs(struct virtnet_info *vi)
> > > +{
> > > +     u32 i, min_size = roundup_pow_of_two(MAX_SKB_FRAGS + 2);
> > 
> > why power of two?
> 
> The ring size is always a power of 2,

Not really, packed rings allow non power of 2.
Linux had a bug that it required power of 2 for packed, but
we are fixing that finally.

> so checking against
> MAX_SKB_FRAGS + 2 or against roundup_pow_of_two will result in the
> same, and I think that printing the warning with the actual min value
> is more helpful.  I can check the condition against MAX_SKB_FRAGS + 2,
> and print the rounded value in case of an error.
> 


  reply	other threads:[~2023-04-23 11:10 UTC|newest]

Thread overview: 39+ 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 16:54 ` Alvaro Karsz
2023-04-16 20:45   ` Michael S. Tsirkin
2023-04-17  3:24     ` Jason Wang
2023-04-17  6:20       ` Michael S. Tsirkin
2023-04-17  6:38         ` Alvaro Karsz
2023-04-17  6:41           ` Michael S. Tsirkin
2023-04-17  7:03             ` Alvaro Karsz
2023-04-17  7:10               ` Michael S. Tsirkin
2023-04-17  7:33                 ` Alvaro Karsz
2023-04-17  9:20                   ` Michael S. Tsirkin
2023-04-17 10:04                     ` Alvaro Karsz
2023-04-17 11:40                       ` Michael S. Tsirkin
2023-04-17 11:51                         ` Alvaro Karsz
2023-04-17 11:57                           ` Michael S. Tsirkin
2023-04-23  6:51                             ` Alvaro Karsz
2023-04-23  7:19                               ` Michael S. Tsirkin
2023-04-23  7:52                                 ` Alvaro Karsz
2023-04-23 11:06                                   ` Michael S. Tsirkin
2023-04-23 12:28                                     ` Alvaro Karsz
2023-04-23 20:17                                       ` Michael S. Tsirkin
2023-04-25  8:34                                       ` Michael S. Tsirkin
2023-04-25  9:41                                         ` Alvaro Karsz
2023-04-25 11:11                                           ` Alvaro Karsz
2023-04-25 12:33                                             ` Michael S. Tsirkin
2023-04-25 12:31                                           ` Michael S. Tsirkin
2023-04-25 13:02                                             ` Alvaro Karsz
2023-04-25 13:08                                               ` Michael S. Tsirkin
2023-04-23  8:01                                 ` Alvaro Karsz
2023-04-23 11:08                                   ` Michael S. Tsirkin
2023-04-17  6:44           ` Xuan Zhuo
2023-04-17  7:07             ` Alvaro Karsz
2023-04-17  7:11               ` Michael S. Tsirkin
2023-04-16 20:38 ` Michael S. Tsirkin
2023-04-17  6:43   ` Alvaro Karsz
2023-04-23 11:09     ` Michael S. Tsirkin [this message]
2023-04-17  1:53 ` Xuan Zhuo
2023-04-17  6:47   ` Alvaro Karsz
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=20230423070849-mutt-send-email-mst@kernel.org \
    --to=mst@redhat$(echo .)com \
    --cc=alvaro.karsz@solid-run$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=edumazet@google$(echo .)com \
    --cc=jasowang@redhat$(echo .)com \
    --cc=kuba@kernel$(echo .)org \
    --cc=linux-kernel@vger$(echo .)kernel.org \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pabeni@redhat$(echo .)com \
    --cc=virtualization@lists$(echo .)linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox