[PATCH v2 04/22] vfio/pci: Register a file handler with Live Update Orchestrator
David Matlack
dmatlack at google.com
Thu Mar 19 15:09:18 PDT 2026
On Wed, Feb 25, 2026 at 3:55 PM Samiullah Khawaja <skhawaja at google.com> wrote:
>
> On Wed, Feb 25, 2026 at 3:15 PM David Matlack <dmatlack at google.com> wrote:
> >
> > On 2026-02-25 02:33 PM, Alex Williamson wrote:
> > > On Thu, 29 Jan 2026 21:24:51 +0000
> > > David Matlack <dmatlack at google.com> wrote:
> >
> > > > +int __init vfio_pci_liveupdate_init(void)
> > > > +{
> > > > + if (!liveupdate_enabled())
> > > > + return 0;
> > > > +
> > > > + return liveupdate_register_file_handler(&vfio_pci_liveupdate_fh);
> > > > +}
> > >
> > > liveupdate_register_file_handler() "pins" vfio-pci with a
> > > try_module_get(). Since this is done in our module_init function and
> > > unregister occurs in our module_exit function, rather than relative
> > > to any actual device binding or usage, this means vfio-pci CANNOT be
> > > unloaded. That seems bad. Thanks,
> >
> > Good point. So a better approach that would allow vfio-pci to be
> > unloaded would be to register the file handler when the number of
> > devices bound to vfio-pci goes from 0->1 and then unregister on 1->0.
>
> Yeah maybe a kref that gets inc/dec in probe/remove. I have a similar
> problem with iommufd preservation, but I think I can handle it based
> on the number of iommufd open.
>
> I am wondering whether this file handler registration kref stuff can
> be moved into LUO by adding it to LUO file_handler and the modules
> only call get/put?
Circling back here, the new plan is for LUO to not take a module
reference in liveupdate_register_file_handler():
https://lore.kernel.org/lkml/20260318141637.1870220-13-pasha.tatashin@soleen.com/
In the next version of this series I am going to rebase on top of
Pasha's changes and keep the call to
liveupdate_register_file_handler() where it is.
More information about the kexec
mailing list