On Wed, Sep 09, 2015 at 01:45:50PM +0300, Michael S. Tsirkin wrote:
> On Tue, Sep 08, 2015 at 03:38:47PM +0800, Yuanhan Liu wrote:
[snip ....]
> > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
> > index 11e46b5..ca6f7fa 100644
> > --- a/hw/virtio/vhost-user.c
> > +++ b/hw/virtio/vhost-user.c
> > @@ -25,9 +25,10 @@
[snip ....]
> > static int vhost_user_cleanup(struct vhost_dev *dev)
> > {
> > assert(dev->vhost_ops->backend_type == VHOST_BACKEND_TYPE_USER);
>
> In fact, it's a per VQ pair call the way it's coded.
> So pls fix it, call it for all VQs.
I'm trying to address this comment, and I'm a bit confused now: this
call is based on one 'vhost_net' structure, which is related to one
'vhost_dev' structure. One 'vhost_dev', on the other hand, represents
two VQs.
So, you are suggesting to call vhost_user_cleanup() twice at it's upper
level?
--yliu
---
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 2712c6f..6944543 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -988,7 +988,10 @@ void vhost_dev_cleanup(struct vhost_dev *hdev)
}
g_free(hdev->mem);
g_free(hdev->mem_sections);
- hdev->vhost_ops->vhost_backend_cleanup(hdev);
+
+ for (i = 0; i < hdev->nvqs; i++) {
+ hdev->vhost_ops->vhost_backend_cleanup(hdev, i);
+ }
}
/* Stop processing guest IO notifications in qemu.