* [PATCH v2] PCI: cadence: Fix runtime atomic count underflow.
@ 2025-04-19 13:30 Hans Zhang
2025-04-19 16:51 ` Manivannan Sadhasivam
2025-04-19 16:54 ` Manivannan Sadhasivam
0 siblings, 2 replies; 4+ messages in thread
From: Hans Zhang @ 2025-04-19 13:30 UTC (permalink / raw)
To: lpieralisi
Cc: kw, manivannan.sadhasivam, robh, bhelgaas, s-vadapalli,
thomas.richard, linux-pci, linux-kernel, rockswang7, Hans Zhang
If the call to pci_host_probe() in cdns_pcie_host_setup()
fails, PM runtime count is decremented in the error path using
pm_runtime_put_sync().But the runtime count is not incremented by this
driver, but only by the callers (cdns_plat_pcie_probe/j721e_pcie_probe).
And the callers also decrement theruntime PM count in their error path.
So this leads to the below warning from the PM core:
runtime PM usage count underflow!
So fix it by getting rid of pm_runtime_put_sync() in the error path and
directly return the errno.
Fixes: 1b79c5284439 ("PCI: cadence: Add host driver for Cadence PCIe controller")
Signed-off-by: Hans Zhang <18255117159@163.com>
---
drivers/pci/controller/cadence/pcie-cadence-host.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
index 8af95e9da7ce..741e10a575ec 100644
--- a/drivers/pci/controller/cadence/pcie-cadence-host.c
+++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
@@ -570,14 +570,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
if (!bridge->ops)
bridge->ops = &cdns_pcie_host_ops;
- ret = pci_host_probe(bridge);
- if (ret < 0)
- goto err_init;
-
- return 0;
-
- err_init:
- pm_runtime_put_sync(dev);
-
- return ret;
+ return pci_host_probe(bridge);
}
base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
--
2.25.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: cadence: Fix runtime atomic count underflow.
2025-04-19 13:30 [PATCH v2] PCI: cadence: Fix runtime atomic count underflow Hans Zhang
@ 2025-04-19 16:51 ` Manivannan Sadhasivam
2025-04-20 1:24 ` Hans Zhang
2025-04-19 16:54 ` Manivannan Sadhasivam
1 sibling, 1 reply; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-04-19 16:51 UTC (permalink / raw)
To: Hans Zhang
Cc: lpieralisi, kw, robh, bhelgaas, s-vadapalli, thomas.richard,
linux-pci, linux-kernel, rockswang7
On Sat, Apr 19, 2025 at 09:30:58PM +0800, Hans Zhang wrote:
> If the call to pci_host_probe() in cdns_pcie_host_setup()
> fails, PM runtime count is decremented in the error path using
> pm_runtime_put_sync().But the runtime count is not incremented by this
> driver, but only by the callers (cdns_plat_pcie_probe/j721e_pcie_probe).
> And the callers also decrement theruntime PM count in their error path.
> So this leads to the below warning from the PM core:
>
> runtime PM usage count underflow!
>
> So fix it by getting rid of pm_runtime_put_sync() in the error path and
> directly return the errno.
>
> Fixes: 1b79c5284439 ("PCI: cadence: Add host driver for Cadence PCIe controller")
>
This is not the correct Fixes commit. In fact it took me a while to find the
correct one. This exact same issue was already fixed by commit, 19abcd790b51
("PCI: cadence: Fix cdns_pcie_{host|ep}_setup() error path").
But then, this bug got reintroduced while fixing the merge conflict in:
49e427e6bdd1 ("Merge branch 'pci/host-probe-refactor'")
I will change the tag while applying.
- Mani
> Signed-off-by: Hans Zhang <18255117159@163.com>
> ---
> drivers/pci/controller/cadence/pcie-cadence-host.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
> index 8af95e9da7ce..741e10a575ec 100644
> --- a/drivers/pci/controller/cadence/pcie-cadence-host.c
> +++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
> @@ -570,14 +570,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
> if (!bridge->ops)
> bridge->ops = &cdns_pcie_host_ops;
>
> - ret = pci_host_probe(bridge);
> - if (ret < 0)
> - goto err_init;
> -
> - return 0;
> -
> - err_init:
> - pm_runtime_put_sync(dev);
> -
> - return ret;
> + return pci_host_probe(bridge);
> }
>
> base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
> --
> 2.25.1
>
--
மணிவண்ணன் சதாசிவம்
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: cadence: Fix runtime atomic count underflow.
2025-04-19 13:30 [PATCH v2] PCI: cadence: Fix runtime atomic count underflow Hans Zhang
2025-04-19 16:51 ` Manivannan Sadhasivam
@ 2025-04-19 16:54 ` Manivannan Sadhasivam
1 sibling, 0 replies; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-04-19 16:54 UTC (permalink / raw)
To: lpieralisi, Hans Zhang
Cc: Manivannan Sadhasivam, kw, robh, bhelgaas, s-vadapalli,
thomas.richard, linux-pci, linux-kernel, rockswang7
On Sat, 19 Apr 2025 21:30:58 +0800, Hans Zhang wrote:
> If the call to pci_host_probe() in cdns_pcie_host_setup()
> fails, PM runtime count is decremented in the error path using
> pm_runtime_put_sync().But the runtime count is not incremented by this
> driver, but only by the callers (cdns_plat_pcie_probe/j721e_pcie_probe).
> And the callers also decrement theruntime PM count in their error path.
> So this leads to the below warning from the PM core:
>
> [...]
Applied, thanks!
[1/1] PCI: cadence: Fix runtime atomic count underflow.
commit: f8015b6a0db95ce09aaacb236746f33b7a540a3e
Best regards,
--
Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] PCI: cadence: Fix runtime atomic count underflow.
2025-04-19 16:51 ` Manivannan Sadhasivam
@ 2025-04-20 1:24 ` Hans Zhang
0 siblings, 0 replies; 4+ messages in thread
From: Hans Zhang @ 2025-04-20 1:24 UTC (permalink / raw)
To: Manivannan Sadhasivam
Cc: lpieralisi, kw, robh, bhelgaas, s-vadapalli, thomas.richard,
linux-pci, linux-kernel, rockswang7
On 2025/4/20 00:51, Manivannan Sadhasivam wrote:
> On Sat, Apr 19, 2025 at 09:30:58PM +0800, Hans Zhang wrote:
>> If the call to pci_host_probe() in cdns_pcie_host_setup()
>> fails, PM runtime count is decremented in the error path using
>> pm_runtime_put_sync().But the runtime count is not incremented by this
>> driver, but only by the callers (cdns_plat_pcie_probe/j721e_pcie_probe).
>> And the callers also decrement theruntime PM count in their error path.
>> So this leads to the below warning from the PM core:
>>
>> runtime PM usage count underflow!
>>
>> So fix it by getting rid of pm_runtime_put_sync() in the error path and
>> directly return the errno.
>>
>> Fixes: 1b79c5284439 ("PCI: cadence: Add host driver for Cadence PCIe controller")
>>
>
> This is not the correct Fixes commit. In fact it took me a while to find the
> correct one. This exact same issue was already fixed by commit, 19abcd790b51
> ("PCI: cadence: Fix cdns_pcie_{host|ep}_setup() error path").
>
> But then, this bug got reintroduced while fixing the merge conflict in:
> 49e427e6bdd1 ("Merge branch 'pci/host-probe-refactor'")
>
> I will change the tag while applying.
>
Hi Mani,
Thank you very much.
Best regards,
Hans
> - Mani
>
>> Signed-off-by: Hans Zhang <18255117159@163.com>
>> ---
>> drivers/pci/controller/cadence/pcie-cadence-host.c | 11 +----------
>> 1 file changed, 1 insertion(+), 10 deletions(-)
>>
>> diff --git a/drivers/pci/controller/cadence/pcie-cadence-host.c b/drivers/pci/controller/cadence/pcie-cadence-host.c
>> index 8af95e9da7ce..741e10a575ec 100644
>> --- a/drivers/pci/controller/cadence/pcie-cadence-host.c
>> +++ b/drivers/pci/controller/cadence/pcie-cadence-host.c
>> @@ -570,14 +570,5 @@ int cdns_pcie_host_setup(struct cdns_pcie_rc *rc)
>> if (!bridge->ops)
>> bridge->ops = &cdns_pcie_host_ops;
>>
>> - ret = pci_host_probe(bridge);
>> - if (ret < 0)
>> - goto err_init;
>> -
>> - return 0;
>> -
>> - err_init:
>> - pm_runtime_put_sync(dev);
>> -
>> - return ret;
>> + return pci_host_probe(bridge);
>> }
>>
>> base-commit: a24588245776dafc227243a01bfbeb8a59bafba9
>> --
>> 2.25.1
>>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-20 1:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-19 13:30 [PATCH v2] PCI: cadence: Fix runtime atomic count underflow Hans Zhang
2025-04-19 16:51 ` Manivannan Sadhasivam
2025-04-20 1:24 ` Hans Zhang
2025-04-19 16:54 ` Manivannan Sadhasivam
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®