* [PATCH] virtio-net: clear guest_announce feature if no cvq backend
@ 2023-01-24 16:11 Eugenio Pérez
2023-01-25 14:38 ` David Edmondson
2023-02-14 6:53 ` Eugenio Perez Martin
0 siblings, 2 replies; 6+ messages in thread
From: Eugenio Pérez @ 2023-01-24 16:11 UTC (permalink / raw)
To: qemu-devel
Cc: leiyang, Michael S. Tsirkin, gautam.dawar, Jason Wang,
Laurent Vivier
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.
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;
}
--
2.31.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio-net: clear guest_announce feature if no cvq backend
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
2023-01-25 15:52 ` Eugenio Perez Martin
2023-02-14 6:53 ` Eugenio Perez Martin
1 sibling, 1 reply; 6+ messages in thread
From: David Edmondson @ 2023-01-25 14:38 UTC (permalink / raw)
To: Eugenio Pérez
Cc: qemu-devel, leiyang, Michael S. Tsirkin, gautam.dawar, Jason Wang,
Laurent Vivier
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?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio-net: clear guest_announce feature if no cvq backend
2023-01-25 14:38 ` David Edmondson
@ 2023-01-25 15:52 ` Eugenio Perez Martin
2023-01-27 17:03 ` Gautam Dawar
0 siblings, 1 reply; 6+ messages in thread
From: Eugenio Perez Martin @ 2023-01-25 15:52 UTC (permalink / raw)
To: David Edmondson
Cc: qemu-devel, leiyang, Michael S. Tsirkin, gautam.dawar, Jason Wang,
Laurent Vivier
On Wed, Jan 25, 2023 at 4:20 PM David Edmondson
<david.edmondson@oracle.com> wrote:
>
> 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?
>
That's a good question. As far as I know qemu emits an error if only
GUEST_ANNOUNCE is given in a purely emulated device.
At this moment vhost-kernel and vhost-vdpa do not handle it, but
vhost-user do. Would it be beneficial to preserve previous behavior
and passthrough the features? I guess not, so I think we could
simplify those functions on top of this series.
> But anyway:
>
> Reviewed-by: David Edmondson <david.edmondson@oracle.com>
>
Thanks for the review!
> > 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?
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio-net: clear guest_announce feature if no cvq backend
2023-01-25 15:52 ` Eugenio Perez Martin
@ 2023-01-27 17:03 ` Gautam Dawar
0 siblings, 0 replies; 6+ messages in thread
From: Gautam Dawar @ 2023-01-27 17:03 UTC (permalink / raw)
To: Eugenio Perez Martin, David Edmondson
Cc: qemu-devel, leiyang, Michael S. Tsirkin, gautam.dawar, Jason Wang,
Laurent Vivier
On 1/25/23 21:22, Eugenio Perez Martin wrote:
> Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.
>
>
> On Wed, Jan 25, 2023 at 4:20 PM David Edmondson
> <david.edmondson@oracle.com> wrote:
>> 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?
>>
> That's a good question. As far as I know qemu emits an error if only
> GUEST_ANNOUNCE is given in a purely emulated device.
>
> At this moment vhost-kernel and vhost-vdpa do not handle it, but
> vhost-user do. Would it be beneficial to preserve previous behavior
> and passthrough the features? I guess not, so I think we could
> simplify those functions on top of this series.
>
>> But anyway:
>>
>> Reviewed-by: David Edmondson <david.edmondson@oracle.com>
>>
> Thanks for the review!
>
>>> 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?
Reviewed-by: Gautam Dawar <gautam.dawar@amd.com>
Tested-by: Gautam Dawar <gautam.dawar@amd.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio-net: clear guest_announce feature if no cvq backend
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
@ 2023-02-14 6:53 ` Eugenio Perez Martin
2023-02-14 13:23 ` Lei Yang
1 sibling, 1 reply; 6+ messages in thread
From: Eugenio Perez Martin @ 2023-02-14 6:53 UTC (permalink / raw)
To: qemu-devel
Cc: leiyang, Michael S. Tsirkin, gautam.dawar, Jason Wang,
Laurent Vivier
On Tue, Jan 24, 2023 at 5:32 PM Eugenio Pérez <eperezma@redhat.com> 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.
>
> 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.
>
Friendly ping about this patch, as it fell through the cracks if I'm not wrong.
Thanks!
> 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;
> }
>
> --
> 2.31.1
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] virtio-net: clear guest_announce feature if no cvq backend
2023-02-14 6:53 ` Eugenio Perez Martin
@ 2023-02-14 13:23 ` Lei Yang
0 siblings, 0 replies; 6+ messages in thread
From: Lei Yang @ 2023-02-14 13:23 UTC (permalink / raw)
To: Eugenio Perez Martin
Cc: qemu-devel, Michael S. Tsirkin, gautam.dawar, Jason Wang,
Laurent Vivier
QE uses the sim_vdpa device to test this patch and add "ctrl_vq=off"
in the qemu command line. Guest can find this device, there are no any
error messages in guest dmesg, and can migrate successfully.
Tested-by: Lei Yang <leiyang@redhat.com>
Eugenio Perez Martin <eperezma@redhat.com> 于2023年2月14日周二 14:53写道:
>
> On Tue, Jan 24, 2023 at 5:32 PM Eugenio Pérez <eperezma@redhat.com> 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.
> >
> > 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.
> >
>
> Friendly ping about this patch, as it fell through the cracks if I'm not wrong.
>
> Thanks!
>
> > 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;
> > }
> >
> > --
> > 2.31.1
> >
> >
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-02-14 13:24 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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
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).