mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Yicong Yang" <yang.yicong@picoheart.com>
To: "Zhanpeng Zhang" <zhangzhanpeng.jasper@bytedance.com>
Cc: "Shuai Xue" <xueshuai@linux.alibaba.com>,
	 "Jing Zhang" <renyu.zj@linux.alibaba.com>,
	<yang.yicong@picoheart.com>,  "Will Deacon" <will@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	 "Baolin Wang" <baolin.wang@linux.alibaba.com>,
	 "Jonathan Cameron" <Jonathan.Cameron@huawei.com>,
	 <linux-arm-kernel@lists.infradead.org>,
	 <linux-perf-users@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] perf/dwc_pcie: Avoid nested bus notifier locking
Date: Thu, 13 Aug 2026 14:04:45 +0800	[thread overview]
Message-ID: <d7ccd4f5-5804-4c0f-992e-48fe6f0efcb0@picoheart.com> (raw)
In-Reply-To: <20260811160649.28255-1-zhangzhanpeng.jasper@bytedance.com>

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@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/

  reply	other threads:[~2026-08-13  6:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-11 13:17 [PATCH v2 0/2] perf/dwc_pcie: Fix lockdep warnings in device and event setup Zhanpeng Zhang
2026-08-11 16:06 ` [PATCH v2 1/2] perf/dwc_pcie: Avoid nested bus notifier locking Zhanpeng Zhang
2026-08-13  6:04   ` Yicong Yang [this message]
2026-08-11 16:07 ` [PATCH v2 2/2] perf/dwc_pcie: Skip sibling walks for new group leaders Zhanpeng Zhang
2026-08-13  6:15   ` Yicong Yang
2026-10-04 17:15 ` [PATCH v2 0/2] perf/dwc_pcie: Fix lockdep warnings in device and event setup Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7ccd4f5-5804-4c0f-992e-48fe6f0efcb0@picoheart.com \
    --to=yang.yicong@picoheart.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=renyu.zj@linux.alibaba.com \
    --cc=will@kernel.org \
    --cc=xueshuai@linux.alibaba.com \
    --cc=zhangzhanpeng.jasper@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®