[PATCH v2 1/2] perf/dwc_pcie: Avoid nested bus notifier locking
Yicong Yang
yang.yicong at picoheart.com
Wed Aug 12 23:04:45 PDT 2026
On 8/12/26 12:06 AM, Zhanpeng Zhang wrote:
> dwc_pcie_pmu_notifier() registers a synthetic platform device directly from
> the BUS_NOTIFY_ADD_DEVICE callback. Bus notifier callbacks run with the
> bus_notifier rwsem held, so platform_device_register_data() enters the
> platform bus notifier chain before the PCI bus notifier returns. When PCI
> host bridges are registered during late init, lockdep reports this as
> possible recursive locking.
>
> Move platform device reconciliation to a work item that runs after the PCI
> notifier returns. Serialize it with PCI rescan and removal, and parent each
> synthetic device to its Root Port so their lifetimes remain coupled.
>
> During removal, unregister the perf PMU and its CPU hotplug instance before
> PCI resources disappear, then defer only platform device destruction.
> Disable manual bind controls to preserve that ordering.
>
> Fixes: af9597adc2f1 ("drivers/perf: add DesignWare PCIe PMU driver")
> Signed-off-by: Zhanpeng Zhang <zhangzhanpeng.jasper at bytedance.com>
please attach the lockdep warning/trace in the commit for better
understanding the issue..
> ---
> Tested on a RISC-V system with CONFIG_KASAN, CONFIG_PROVE_LOCKING,
> CONFIG_DEBUG_LOCK_ALLOC and CONFIG_LOCKDEP enabled. Late-init PCI discovery
> no longer triggers the nested bus notifier warning.
>
> drivers/perf/dwc_pcie_pmu.c | 149 +++++++++++++++++++++++++++---------
> 1 file changed, 113 insertions(+), 36 deletions(-)
>
[...]
>
> @@ -815,7 +891,11 @@ static int dwc_pcie_pmu_offline_cpu(unsigned int cpu, struct hlist_node *cpuhp_n
>
> static struct platform_driver dwc_pcie_pmu_driver = {
> .probe = dwc_pcie_pmu_probe,
> - .driver = {.name = "dwc_pcie_pmu",},
> + .driver = {
> + .name = "dwc_pcie_pmu",
> + .probe_type = PROBE_FORCE_SYNCHRONOUS,
this looks irrelevant to the issue to resolve. need description here.
I suppose this issue is because both the PMU and the PCIe controller
are on the platform bus, right? If we switch the PMU to the faux device
interface [1] this could be solved?
thanks.
[1] https://lore.kernel.org/all/20260708084507.98242-4-yang.yicong@picoheart.com/
More information about the linux-arm-kernel
mailing list