[PATCH] PCI: liveupdate: Factor out pci_dev_ser allocation and release
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Mon Nov 9 09:48:42 PST 2026
> Move the code that starts and stops preserving a device into
> pci_liveupdate_alloc_dev_ser() and pci_liveupdate_free_dev_ser(), and
> split pci_liveupdate_preserve_device() into separate paths for devices
> that are already preserved and devices being preserved for the first
> time. Leave a single refcount increment shared by both paths.
>
> Since upstream bridges are preserved once for every preserved device
> below them, nr_devices is only incremented when a device's struct
> pci_dev_ser is allocated and only decremented when it is released, not
> on every preserve and unpreserve. Keeping that accounting in a pair of
> helpers makes the relationship explicit.
>
> A side-effect of the refactor to pci_liveupdate_preserve_device() is
> that preserving an already-preserved endpoint after it is frozen now
> fails with -EINVAL instead of -EBUSY, since the frozen check now happens
> first.
>
> Link: https://lore.kernel.org/linux-pci/20261106173427.GA1633106@bhelgaas/
> Suggested-by: Bjorn Helgaas <bhelgaas at google.com>
> Signed-off-by: David Matlack <dmatlack at google.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261109174009.735309-1-dmatlack@google.com?part=1
More information about the kexec
mailing list