diff mbox series

[2/2] virtio-net: delete also control queue when TX/RX deleted

Message ID 20191226043649.14481-3-yuri.benditovich@daynix.com (mailing list archive)
State New, archived
Headers show
Series Solve problem of hot removal of virtio-net-pci | expand

Commit Message

Yuri Benditovich Dec. 26, 2019, 4:36 a.m. UTC
https://bugzilla.redhat.com/show_bug.cgi?id=1708480
If the control queue is not deleted together with TX/RX, it
later will be ignored in freeing cache resources and hot
unplug will not be completed.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
 hw/net/virtio-net.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Michael S. Tsirkin Jan. 1, 2020, 11:43 p.m. UTC | #1
On Thu, Dec 26, 2019 at 06:36:49AM +0200, Yuri Benditovich wrote:
> https://bugzilla.redhat.com/show_bug.cgi?id=1708480
> If the control queue is not deleted together with TX/RX, it
> later will be ignored in freeing cache resources and hot
> unplug will not be completed.
> 
> Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> ---
>  hw/net/virtio-net.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index db3d7c38e6..f325440d01 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -3101,7 +3101,8 @@ static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
>      for (i = 0; i < max_queues; i++) {
>          virtio_net_del_queue(n, i);
>      }
> -
> +    /* delete also control vq */
> +    virtio_del_queue(vdev, max_queues * 2);
>      qemu_announce_timer_del(&n->announce_timer, false);
>      g_free(n->vqs);
>      qemu_del_nic(n->nic);

Do we need to limit this to when ctrl vq exists?

> -- 
> 2.17.1
Yuri Benditovich Jan. 2, 2020, 6:52 a.m. UTC | #2
On Thu, Jan 2, 2020 at 1:43 AM Michael S. Tsirkin <mst@redhat.com> wrote:

> On Thu, Dec 26, 2019 at 06:36:49AM +0200, Yuri Benditovich wrote:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1708480
> > If the control queue is not deleted together with TX/RX, it
> > later will be ignored in freeing cache resources and hot
> > unplug will not be completed.
> >
> > Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
> > ---
> >  hw/net/virtio-net.c | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> > index db3d7c38e6..f325440d01 100644
> > --- a/hw/net/virtio-net.c
> > +++ b/hw/net/virtio-net.c
> > @@ -3101,7 +3101,8 @@ static void
> virtio_net_device_unrealize(DeviceState *dev, Error **errp)
> >      for (i = 0; i < max_queues; i++) {
> >          virtio_net_del_queue(n, i);
> >      }
> > -
> > +    /* delete also control vq */
> > +    virtio_del_queue(vdev, max_queues * 2);
> >      qemu_announce_timer_del(&n->announce_timer, false);
> >      g_free(n->vqs);
> >      qemu_del_nic(n->nic);
>
> Do we need to limit this to when ctrl vq exists?
>

ctrl vq always exists (we _add_ it unconditionally).
we may suggest respective feature or not, but the initialized queue
structure present.


>
> > --
> > 2.17.1
>
>
diff mbox series

Patch

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index db3d7c38e6..f325440d01 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -3101,7 +3101,8 @@  static void virtio_net_device_unrealize(DeviceState *dev, Error **errp)
     for (i = 0; i < max_queues; i++) {
         virtio_net_del_queue(n, i);
     }
-
+    /* delete also control vq */
+    virtio_del_queue(vdev, max_queues * 2);
     qemu_announce_timer_del(&n->announce_timer, false);
     g_free(n->vqs);
     qemu_del_nic(n->nic);