qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: David Edmondson <david.edmondson@oracle.com>
To: "Eugenio Pérez" <eperezma@redhat.com>
Cc: qemu-devel@nongnu.org, leiyang@redhat.com,
	"Michael S. Tsirkin" <mst@redhat.com>,
	gautam.dawar@amd.com, Jason Wang <jasowang@redhat.com>,
	Laurent Vivier <lvivier@redhat.com>
Subject: Re: [PATCH] virtio-net: clear guest_announce feature if no cvq backend
Date: Wed, 25 Jan 2023 14:38:22 +0000	[thread overview]
Message-ID: <m2y1pq1xy9.fsf@oracle.com> (raw)
In-Reply-To: <20230124161159.2182117-1-eperezma@redhat.com> ("Eugenio Pérez"'s message of "Tue, 24 Jan 2023 17:11:59 +0100")

On Tuesday, 2023-01-24 at 17:11:59 +01, Eugenio Pérez wrote:
> Since GUEST_ANNOUNCE is emulated the feature bit could be set without
> backend support.  This happens in the vDPA case.
>
> However, backend vDPA parent may not have CVQ support.  This causes an
> incoherent feature set, and the driver may refuse to start.  This
> happens in virtio-net Linux driver.

Could you now simplify the tests in virtio_net_announce() and
virtio_net_post_load_device() to look only for the presence of
GUEST_ANNOUNCE, given that you can now presume that it implies CTRL_VQ?

But anyway:

Reviewed-by: David Edmondson <david.edmondson@oracle.com>

> This may be solved differently in the future.  Qemu is able to emulate a
> CVQ just for guest_announce purposes, helping guest to notify the new
> location with vDPA devices that does not support it.  However, this is
> left as a TODO as it is way more complex to backport.
>
> Tested with vdpa_net_sim, toggling manually VIRTIO_NET_F_CTRL_VQ in the
> driver and migrating it with x-svq=on.
>
> Fixes: 980003debddd ("vdpa: do not handle VIRTIO_NET_F_GUEST_ANNOUNCE in vhost-vdpa")
> Reported-by: Dawar, Gautam <gautam.dawar@amd.com>
> Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
> ---
>  hw/net/virtio-net.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 3ae909041a..09d5c7a664 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -820,6 +820,21 @@ static uint64_t virtio_net_get_features(VirtIODevice *vdev, uint64_t features,
>          features |= (1ULL << VIRTIO_NET_F_MTU);
>      }
>
> +    /*
> +     * Since GUEST_ANNOUNCE is emulated the feature bit could be set without
> +     * enabled. This happens in the vDPA case.
> +     *
> +     * Make sure the feature set is not incoherent, as the driver could refuse
> +     * to start.
> +     *
> +     * TODO: QEMU is able to emulate a CVQ just for guest_announce purposes,
> +     * helping guest to notify the new location with vDPA devices that does not
> +     * support it.
> +     */
> +    if (!virtio_has_feature(vdev->backend_features, VIRTIO_NET_F_CTRL_VQ)) {
> +        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ANNOUNCE);
> +    }
> +
>      return features;
>  }
-- 
Why stay in college? Why go to night school?


  reply	other threads:[~2023-01-25 15:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 16:11 [PATCH] virtio-net: clear guest_announce feature if no cvq backend Eugenio Pérez
2023-01-25 14:38 ` David Edmondson [this message]
2023-01-25 15:52   ` Eugenio Perez Martin
2023-01-27 17:03     ` Gautam Dawar
2023-02-14  6:53 ` Eugenio Perez Martin
2023-02-14 13:23   ` Lei Yang

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=m2y1pq1xy9.fsf@oracle.com \
    --to=david.edmondson@oracle.com \
    --cc=eperezma@redhat.com \
    --cc=gautam.dawar@amd.com \
    --cc=jasowang@redhat.com \
    --cc=leiyang@redhat.com \
    --cc=lvivier@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.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).