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: Sun, 23 Apr 2023 03:19:15 -0400 [thread overview]
Message-ID: <20230423031308-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <AM0PR04MB4723FA90465186B5A8A5C001D4669@AM0PR04MB4723.eurprd04.prod.outlook.com>
On Sun, Apr 23, 2023 at 06:51:46AM +0000, Alvaro Karsz wrote:
> > Yes that makes sense, it's architetural. We can disable ctrl vq though.
>
> The problem here is that we know the vring size after calling virtnet_find_vqs, so the number of VQs already includes the control VQ.
>
> Actually, many variables/settings that are initialized before we call virtnet_find_vqs may need modifications if we use small vrings.
> For example has_rss_hash_report, has_rss, hdr_len etc..
>
> We could have a fixup function to fix everything after we discover that we are using small vrings, but, honestly, I think that this will be hard to maintain in the future, and I don't like this approach much.
>
> The ideal thing will be to discover if we use small vrings in probe's beginning.
>
> I'm looking for a way at the moment.
Hmm. I was wrong. There is no way to disable CVQ feature bit.
1. Reset the device.
2. Set the ACKNOWLEDGE status bit: the guest OS has notice the device.
3. Set the DRIVER status bit: the guest OS knows how to drive the device.
4. Read device feature bits, and write the subset of feature bits understood by the OS and driver to the
device. During this step the driver MAY read (but MUST NOT write) the device-specific configuration
fields to check that it can support the device before accepting it.
5. Set the FEATURES_OK status bit. The driver MUST NOT accept new feature bits after this step.
6. Re-read device status to ensure the FEATURES_OK bit is still set: otherwise, the device does not
support our subset of features and the device is unusable.
7. Perform device-specific setup, including discovery of virtqueues for the device, optional per-bus setup,
reading and possibly writing the device’s virtio configuration space, and population of virtqueues.
8. Set the DRIVER_OK status bit. At this point the device is “live”.
So features are confirmed before find vqs.
The rest of stuff can probably just be moved to after find_vqs without
much pain.
So if cvq is too small we can either
- probe but avoid using cvq
or
- fail probe
--
MST
next prev parent reply other threads:[~2023-04-23 7:21 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 [this message]
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
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=20230423031308-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=jasowang@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).