[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <82a28788-eed8-6cff-c2ee-fb4b421ae53c@huawei.com>
Date: Fri, 16 Aug 2024 15:42:01 +0800
From: Yicong Yang <yangyicong@...wei.com>
To: Krishna Chaitanya Chundru <quic_krichai@...cinc.com>
CC: <yangyicong@...ilicon.com>, Shuai Xue <xueshuai@...ux.alibaba.com>, Jing
Zhang <renyu.zj@...ux.alibaba.com>, Will Deacon <will@...nel.org>, Mark
Rutland <mark.rutland@....com>, Baolin Wang <baolin.wang@...ux.alibaba.com>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>, Jonathan Corbet
<corbet@....net>, <linux-arm-kernel@...ts.infradead.org>,
<linux-arm-msm@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-doc@...r.kernel.org>, <quic_vbadigan@...cinc.com>,
<quic_nitegupt@...cinc.com>, <quic_skananth@...cinc.com>,
<quic_ramkri@...cinc.com>, <quic_parass@...cinc.com>,
<quic_mrana@...cinc.com>
Subject: Re: [PATCH 3/4] perf/dwc_pcie: Always register for PCIe bus notifier
On 2024/8/16 11:51, Krishna Chaitanya Chundru wrote:
>
>
> On 8/15/2024 7:19 PM, Yicong Yang wrote:
>> On 2024/7/31 12:23, Krishna chaitanya chundru wrote:
>>> When the PCIe devices are discovered late, the driver can't find
>>> the PCIe devices and returns in the init without registering with
>>> the bus notifier. Due to that the devices which are discovered late
>>> the driver can't register for this.
>>>
>>> Register for bus notifier even if the device is not found in init.
>>>
>>> Fixes: af9597adc2f1 ("drivers/perf: add DesignWare PCIe PMU driver")
>>> Signed-off-by: Krishna chaitanya chundru <quic_krichai@...cinc.com>
>>> ---
>>> drivers/perf/dwc_pcie_pmu.c | 10 +++++-----
>>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/perf/dwc_pcie_pmu.c b/drivers/perf/dwc_pcie_pmu.c
>>> index c115348b8d53..aa1010b44bcb 100644
>>> --- a/drivers/perf/dwc_pcie_pmu.c
>>> +++ b/drivers/perf/dwc_pcie_pmu.c
>>> @@ -741,8 +741,6 @@ static int __init dwc_pcie_pmu_init(void)
>>> found = true;
>>> }
>>> - if (!found)
>>> - return -ENODEV;
>>> ret = cpuhp_setup_state_multi(CPUHP_AP_ONLINE_DYN,
>>> "perf/dwc_pcie_pmu:online",
>>> @@ -753,9 +751,11 @@ static int __init dwc_pcie_pmu_init(void)
>>> dwc_pcie_pmu_hp_state = ret;
>>> - ret = platform_driver_register(&dwc_pcie_pmu_driver);
>>> - if (ret)
>>> - goto platform_driver_register_err;
>>> + if (!found) {
>>> + ret = platform_driver_register(&dwc_pcie_pmu_driver);
>>> + if (ret)
>>> + goto platform_driver_register_err;
>>> + }
>>>
>>
>> This doesn't match the commit.
>> > If any device is found at this stage, we cannot use them since you don't
>> register a driver.
>>
> If the device is not found then only we are skipping platform driver
> register otherwise driver will be registering with the platform driver.
>
think about the case that devices already discovered before module init.
without the change here we'll register both the platform devices and driver
but with the change here we'll only register the platform devices without
the related driver to probe them.
Try to register the driver and notifier unconditionally will solve the issue.
It'll probe the device and register the PMU if later device is added by
the bus notifier.
Thanks.
> - Krishna Chaitanya.
>>> ret = bus_register_notifier(&pci_bus_type, &dwc_pcie_pmu_nb);
>>> if (ret)
>>>
>
> .
Powered by blists - more mailing lists