Re: [PATCH 1/3] VFIO: take reference to the KVM module

Sean Christopherson
2026-04-09T18:59:03Z

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.