[Devel] [PATCH hci-8.1 v3 0/1] vfio: kvm reference leak on live update
Konstantin Khorenko
khorenko at virtuozzo.com
Thu Nov 5 20:51:18 MSK 2026
Applying with these fixes on my side:
- commit message: KVMGT reads device->kvm while the guest runs too,
not only in open_device() and at close;
- struct vfio_device comment: the flag is for a driver that uses
device->kvm while the device is open, not only in open_device();
- the comments before the kvm get in vfio_df_group_open() and
vfio_df_ioctl_bind_iommufd(): the pointer is saved only when the
driver set needs_kvm_ref.
On Thu, 5 Nov 2026 16:17:58 +0200, Andrey Drobyshev wrote:
> Andrey Drobyshev (1):
> vfio: take the kvm reference only for drivers that read device->kvm
Thanks, the code is right, and the test with this patch alone answers
the patch 2 question.
The first two fixes undo a mistake of mine: item 1 of my v2 reply said
"in open_device(), not after it". That holds for vfio_ap and zdev, but
KVMGT also calls kvm_write_track_add_gfn() on device->kvm while the
guest runs. Details are in the reply to the patch.
For the mainline version (VSTOR-153437): all three drivers already
take their own reference on the kvm in open_device(). So upstream may
prefer the core to hold its reference only across open_device() and
drop it right after, with no flag at all. Worth raising there.
--
Konstantin Khorenko,
Virtuozzo Linux Kernel Team
More information about the Devel
mailing list