On Wed, 2025-08-20 at 10:34 +0800, Jason Wang wrote: > On Wed, Aug 20, 2025 at 12:13 AM David Woodhouse <dw...@infradead.org> wrote: > > > > On Mon, 2025-03-10 at 20:22 +0800, Jason Wang wrote: > > > From: Eugenio Pérez <epere...@redhat.com> > > > > > > Commit a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net > > > structures if peer nic is present") effectively delayed the backend > > > cleanup, allowing the frontend or the guest to access it resources as > > > long as the frontend is still visible to the guest. > > > > > > However it does not clean up the resources until the qemu process is > > > over. This causes an effective leak if the device is deleted with > > > device_del, as there is no way to close the vdpa device. This makes > > > impossible to re-add that device to this or other QEMU instances until > > > the first instance of QEMU is finished. > > > > > > Move the cleanup from qemu_cleanup to the NIC deletion and to > > > net_cleanup. > > > > > > Fixes: a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net > > > structures if peer nic is present") > > > Reported-by: Lei Yang <leiy...@redhat.com> > > > Signed-off-by: Eugenio Pérez <epere...@redhat.com> > > > Signed-off-by: Jonah Palmer <jonah.pal...@oracle.com> > > > Signed-off-by: Jason Wang <jasow...@redhat.com> > > > > This crashes QEMU when I launch an emulated Xen guest with a Xen PV > > NIC, and quit (using Ctrl-A x on the monitor). > > Eugenio and Jonah, any thoughts on this? It looks like the code > doesn't deal with hub correctly.
The interesting part about Xen netback is that it does its own teardown from xen_device_unrealize() because in the case of running under true Xen, it needs to clean up XenStore nodes which are externally visible. It doesn't all just go away when QEMU exits. We fixed a potentially similar issue in commit 84f85eb95f14a ("net: do not delete nics in net_cleanup()")? I should add a test case for this...
smime.p7s
Description: S/MIME cryptographic signature