On Thu, 11 Jun 2026 at 11:46, David Marchand <[email protected]> wrote: > > This is a followup of the previous bus refactoring. > See > https://inbox.dpdk.org/dev/CAJFAV8zvFpLwz8SY8DUUezyJyM43eRZ17Yj30ex808eHC4ZE=g...@mail.gmail.com/. > > This series refactors the bus cleanup infrastructure to reduce code > duplication and fix resource leaks in several bus drivers. > It should address the leak Thomas pointed at. > > The first part of the series (patches 1-8) addresses several bugs and > inconsistencies: > - Documentation and log message inconsistencies from earlier bus > refactoring > - Device list management issues in dma/idxd and bus/vdev > - Resource leaks in PCI and VMBUS bus cleanup (mappings and interrupts) > - Simplified device freeing in NXP buses (DPAA and FSLMC) > - Deferred interrupt allocation to probe time (NXP buses, VMBUS) > > The core infrastructure changes (patches 9-10) introduce the generic > cleanup framework: > - Refactors unplug operations to be the counterpart of probe_device > - Implements rte_bus_generic_cleanup() to centralize cleanup logic > - Adds .free_device operation to struct rte_bus > - Adds compile-time verification that rte_device is at offset 0 > > The final patches (11-13) convert remaining buses to use the generic > cleanup helper: > - DPAA bus: add unplug support > - VMBUS bus: switch to embedded device name and add unplug support > > After this series, most buses use the generic cleanup helper, eliminating > duplicated code and ensuring consistent cleanup behavior across the > codebase.
The remaining bus that do not use the generic helper are: - dma/idxd which has no unplug support, - bus/cdx which has unplug support, but no cleanup (it should not be that complex to achieve, but I did not try), - bus/fslmc which has unplug support, but a strange cleanup that does not do much except release some hw resources, One important point is that the series in its current form induces a change in behavior. rte_dev_remove (iow unplugging a device) now leaves the dev object in the bus list. I chose this implementation as it makes the API more symmetric (allocations in .scan are released in .cleanup, allocations in .probe_device are released in .unplug_device). I wonder if this would be problematic for the vdev bus in some usecase where many ports are hotplugged then unplugged and never reused. -- David Marchand

