Re: [PATCH 1/3] VFIO: take reference to the KVM module
From: Sean Christopherson
Date: Thu Apr 09 2026 - 14:59:54 EST
On Tue, Apr 07, 2026, Paolo Bonzini wrote:
> VFIO is implicitly taking a reference to the KVM module between
> vfio_device_get_kvm_safe and vfio_device_put_kvm, thanks to
> symbol_get and symbol_put.
>
> In preparation for removing symbol_get and symbol_put themselves
> from VFIO, actually store a pointer to the KVM module and use
> module_get()/module_put() to keep KVM alive.
NAK? :-)
I really don't think we should do this. We're reinventing the wheel, and probably
doing so poorly. As Jason suggested, the proper way to handle this is to pass
a "struct file" so that e.g. fops_get() pins kvm.ko for us.
https://lore.kernel.org/all/20231203140756.GI1489931@xxxxxxxx