Re: [PATCH RFC 15/15] hw/virtio/vhost-user: shadow vq cleanup
Connor Kite <[email protected]>
| Newsgroups | dev.linux.lists.virtio-fs,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <CA+spn3osjNAokBGi-hERm4z-Gwz22ORQC1Ag65okv-HSrZ9JVQ@mail.gmail.com> |
On Fri, Jul 24, 2026 at 8:22 AM Akihiko Odaki <[email protected]> wrote: > > On 2026/07/24 7:30, Connor Kite wrote: > > Implements functionality to cleanup svqs on cleanup of isolation > > regions. > > > > Signed-off-by: Connor Kite <[email protected]> > > --- > > hw/virtio/vhost-user.c | 10 ++++++++++ > > 1 file changed, 10 insertions(+) > > > > diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c > > index e65f877f9a..bb4de78b95 100644 > > --- a/hw/virtio/vhost-user.c > > +++ b/hw/virtio/vhost-user.c > > @@ -1140,6 +1140,15 @@ static int vhost_user_set_mem_table_postcopy(struct vhost_dev *dev, > > return 0; > > } > > > > +static void vhost_user_svq_cleanup(struct vhost_user *u) > > +{ > > + for (int i = 0; i < u->shadow_vqs->len; i++) { > > + vhost_svq_stop(g_ptr_array_index(u->shadow_vqs, i)); > > + } > > + > > + g_ptr_array_free(u->shadow_vqs, true); > > +} > > + > > /* TODO: Is there any notifier cleanup required here?*/ > > static void cleanup_isolation_regions(struct vhost_dev *dev) > > { > > @@ -1147,6 +1156,7 @@ static void cleanup_isolation_regions(struct vhost_dev *dev) > > if (u->iso_memory.base_addr) { > > vhost_iova_tree_delete(u->iso_iova_tree); > > u->iso_iova_tree = NULL; > > + vhost_user_svq_cleanup(u); > > Memory-table refresh frees live SVQs permanently. > init_isolation_regions() uses cleanup for refreshes, but cleanup frees > shadow_vqs; they are created only once during backend initialization. > > Regards, > Akihiko Odaki Got it! This should now be resolved so that the svq array only gets freed on final cleanup, rather than on reset.