From: Jason Wang <jasowang@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>, linux-kernel@vger.kernel.org
Cc: Alistair Delva <adelva@google.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org
Subject: Re: [PATCH v2] virtio_net: CTRL_GUEST_OFFLOADS depends on CTRL_VQ
Date: Mon, 6 Jan 2020 10:47:35 +0800 [thread overview]
Message-ID: <2d7053b5-295c-4051-a722-7656350bdb74@redhat.com> (raw)
In-Reply-To: <20200105132120.92370-1-mst@redhat.com>
On 2020/1/5 下午9:22, Michael S. Tsirkin wrote:
> The only way for guest to control offloads (as enabled by
> VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) is by sending commands
> through CTRL_VQ. So it does not make sense to
> acknowledge VIRTIO_NET_F_CTRL_GUEST_OFFLOADS without
> VIRTIO_NET_F_CTRL_VQ.
>
> The spec does not outlaw devices with such a configuration, so we have
> to support it. Simply clear VIRTIO_NET_F_CTRL_GUEST_OFFLOADS.
> Note that Linux is still crashing if it tries to
> change the offloads when there's no control vq.
> That needs to be fixed by another patch.
>
> Reported-by: Alistair Delva <adelva@google.com>
> Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Fixes: 3f93522ffab2 ("virtio-net: switch off offloads on demand if possible on XDP set")
> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
> ---
>
> Same patch as v1 but update documentation so it's clear it's not
> enough to fix the crash.
>
> drivers/net/virtio_net.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 4d7d5434cc5d..7b8805b47f0d 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -2971,6 +2971,15 @@ static int virtnet_validate(struct virtio_device *vdev)
> if (!virtnet_validate_features(vdev))
> return -EINVAL;
>
> + /* VIRTIO_NET_F_CTRL_GUEST_OFFLOADS does not work without
> + * VIRTIO_NET_F_CTRL_VQ. Unfortunately spec forgot to
> + * specify that VIRTIO_NET_F_CTRL_GUEST_OFFLOADS depends
> + * on VIRTIO_NET_F_CTRL_VQ so devices can set the later but
> + * not the former.
> + */
> + if (!virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_VQ))
> + __virtio_clear_bit(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS);
If it's just because a bug of spec, should we simply fix the bug and
fail the negotiation in virtnet_validate_feature()?
Otherwise there would be inconsistency in handling feature dependencies
for ctrl vq.
Thanks
> +
> if (virtio_has_feature(vdev, VIRTIO_NET_F_MTU)) {
> int mtu = virtio_cread16(vdev,
> offsetof(struct virtio_net_config,
next prev parent reply other threads:[~2020-01-06 2:48 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-05 13:22 Michael S. Tsirkin
2020-01-06 2:47 ` Jason Wang [this message]
2020-01-06 12:54 ` Michael S. Tsirkin
2020-01-07 2:29 ` Jason Wang
2020-01-07 7:06 ` Michael S. Tsirkin
2020-01-07 8:31 ` Jason Wang
2020-01-10 2:33 ` David Miller
2020-01-10 6:12 ` Michael S. Tsirkin
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=2d7053b5-295c-4051-a722-7656350bdb74@redhat.com \
--to=jasowang@redhat.com \
--cc=adelva@google.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=willemdebruijn.kernel@gmail.com \
/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
all inboxes | Powered by JetHome®