Message ID | 20240716094619.1713905-1-eric.auger@redhat.com (mailing list archive) |
---|---|
Headers | show |
Series | VIRTIO-IOMMU/VFIO: Revert IOMMUDevice clear and fix hotunplug | expand |
On 7/16/24 11:45, Eric Auger wrote: > 1b889d6e39c3 ("virtio-iommu: Clear IOMMUDevice when VFIO > device is unplugged" fixes the VFIO hotplug/hotunplug/hotplug > sequence by clearing the IOMMUDevice which backs the VFIO device. > However this brings other troubles such as a memory corruption. > > Even when fixing some cleanups that were missed on the first > attempt the memory corruption still exists if the IOMMUDevice is > freed. Until we understand the exact cause let's make things simpler: > let the backing IOMMUDevice survive the unplug as what is done > on intel iommu for instance. Clean up/reset resources that would > prevent the device from being hotplugged again (probe_done is removed, > [host_]resv_regions are reset). By doing this we also rule out the > use case of aliased BDFs which is known to be not functional with > virtio-iommu (missing guest kernel support) and the virtio-iommu device > implementation is not ready either. > > This series can be found at: > https://github.com/eauger/qemu/tree/virtio_iommu_device_clear_fixes_v1 > > > Eric Auger (6): > Revert "virtio-iommu: Clear IOMMUDevice when VFIO device is unplugged" > virtio-iommu: Remove probe_done > virtio-iommu: Free [host_]resv_ranges on unset_iommu_devices > virtio-iommu: Remove the end point on detach > hw/vfio/common: Add vfio_listener_region_del_iommu trace event > virtio-iommu: Add trace point on > virtio_iommu_detach_endpoint_from_domain > > include/hw/virtio/virtio-iommu.h | 1 - > hw/vfio/common.c | 3 +- > hw/virtio/virtio-iommu.c | 88 +++++++++++--------------------- > hw/vfio/trace-events | 3 +- > hw/virtio/trace-events | 1 + > 5 files changed, 35 insertions(+), 61 deletions(-) > Tested-by: Cédric Le Goater <clg@redhat.com> with a vfio-pci device (mlx5 VF) and a virtio-net-pci device. Thanks, C.
Hi Cédric, On 7/16/24 16:02, Cédric Le Goater wrote: > On 7/16/24 11:45, Eric Auger wrote: >> 1b889d6e39c3 ("virtio-iommu: Clear IOMMUDevice when VFIO >> device is unplugged" fixes the VFIO hotplug/hotunplug/hotplug >> sequence by clearing the IOMMUDevice which backs the VFIO device. >> However this brings other troubles such as a memory corruption. >> >> Even when fixing some cleanups that were missed on the first >> attempt the memory corruption still exists if the IOMMUDevice is >> freed. Until we understand the exact cause let's make things simpler: >> let the backing IOMMUDevice survive the unplug as what is done >> on intel iommu for instance. Clean up/reset resources that would >> prevent the device from being hotplugged again (probe_done is removed, >> [host_]resv_regions are reset). By doing this we also rule out the >> use case of aliased BDFs which is known to be not functional with >> virtio-iommu (missing guest kernel support) and the virtio-iommu device >> implementation is not ready either. >> >> This series can be found at: >> https://github.com/eauger/qemu/tree/virtio_iommu_device_clear_fixes_v1 >> >> >> Eric Auger (6): >> Revert "virtio-iommu: Clear IOMMUDevice when VFIO device is >> unplugged" >> virtio-iommu: Remove probe_done >> virtio-iommu: Free [host_]resv_ranges on unset_iommu_devices >> virtio-iommu: Remove the end point on detach >> hw/vfio/common: Add vfio_listener_region_del_iommu trace event >> virtio-iommu: Add trace point on >> virtio_iommu_detach_endpoint_from_domain >> >> include/hw/virtio/virtio-iommu.h | 1 - >> hw/vfio/common.c | 3 +- >> hw/virtio/virtio-iommu.c | 88 +++++++++++--------------------- >> hw/vfio/trace-events | 3 +- >> hw/virtio/trace-events | 1 + >> 5 files changed, 35 insertions(+), 61 deletions(-) >> > > > Tested-by: Cédric Le Goater <clg@redhat.com> > > with a vfio-pci device (mlx5 VF) and a virtio-net-pci device. Many Thanks! Eric > > Thanks, > > C. >