diff mbox series

soc: qcom: icc-bwmon: Fix refcount imbalance seen during bwmon_remove

Message ID 20240613164506.982068-1-quic_sibis@quicinc.com (mailing list archive)
State Accepted
Headers show
Series soc: qcom: icc-bwmon: Fix refcount imbalance seen during bwmon_remove | expand

Commit Message

Sibi Sankar June 13, 2024, 4:45 p.m. UTC
The following warning is seen during bwmon_remove due to refcount
imbalance, fix this by releasing the OPPs after use.

Logs:
WARNING: at drivers/opp/core.c:1640 _opp_table_kref_release+0x150/0x158
Hardware name: Qualcomm Technologies, Inc. X1E80100 CRD (DT)
...
Call trace:
_opp_table_kref_release+0x150/0x158
dev_pm_opp_remove_table+0x100/0x1b4
devm_pm_opp_of_table_release+0x10/0x1c
devm_action_release+0x14/0x20
devres_release_all+0xa4/0x104
device_unbind_cleanup+0x18/0x60
device_release_driver_internal+0x1ec/0x228
driver_detach+0x50/0x98
bus_remove_driver+0x6c/0xbc
driver_unregister+0x30/0x60
platform_driver_unregister+0x14/0x20
bwmon_driver_exit+0x18/0x524 [icc_bwmon]
__arm64_sys_delete_module+0x184/0x264
invoke_syscall+0x48/0x118
el0_svc_common.constprop.0+0xc8/0xe8
do_el0_svc+0x20/0x2c
el0_svc+0x34/0xdc
el0t_64_sync_handler+0x13c/0x158
el0t_64_sync+0x190/0x194
--[ end trace 0000000000000000 ]---

Fixes: 0276f69f13e2 ("soc: qcom: icc-bwmon: Set default thresholds dynamically")
Fixes: b9c2ae6cac40 ("soc: qcom: icc-bwmon: Add bandwidth monitoring driver")
Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
---
 drivers/soc/qcom/icc-bwmon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Konrad Dybcio June 13, 2024, 5:29 p.m. UTC | #1
On 6/13/24 18:45, Sibi Sankar wrote:
> The following warning is seen during bwmon_remove due to refcount
> imbalance, fix this by releasing the OPPs after use.
> 
> Logs:
> WARNING: at drivers/opp/core.c:1640 _opp_table_kref_release+0x150/0x158
> Hardware name: Qualcomm Technologies, Inc. X1E80100 CRD (DT)
> ...
> Call trace:
> _opp_table_kref_release+0x150/0x158
> dev_pm_opp_remove_table+0x100/0x1b4
> devm_pm_opp_of_table_release+0x10/0x1c
> devm_action_release+0x14/0x20
> devres_release_all+0xa4/0x104
> device_unbind_cleanup+0x18/0x60
> device_release_driver_internal+0x1ec/0x228
> driver_detach+0x50/0x98
> bus_remove_driver+0x6c/0xbc
> driver_unregister+0x30/0x60
> platform_driver_unregister+0x14/0x20
> bwmon_driver_exit+0x18/0x524 [icc_bwmon]
> __arm64_sys_delete_module+0x184/0x264
> invoke_syscall+0x48/0x118
> el0_svc_common.constprop.0+0xc8/0xe8
> do_el0_svc+0x20/0x2c
> el0_svc+0x34/0xdc
> el0t_64_sync_handler+0x13c/0x158
> el0t_64_sync+0x190/0x194
> --[ end trace 0000000000000000 ]---
> 
> Fixes: 0276f69f13e2 ("soc: qcom: icc-bwmon: Set default thresholds dynamically")
> Fixes: b9c2ae6cac40 ("soc: qcom: icc-bwmon: Add bandwidth monitoring driver")
> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
> ---

Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Konrad
Konrad Dybcio June 13, 2024, 5:30 p.m. UTC | #2
On 6/13/24 19:29, Konrad Dybcio wrote:
> 
> 
> On 6/13/24 18:45, Sibi Sankar wrote:
>> The following warning is seen during bwmon_remove due to refcount
>> imbalance, fix this by releasing the OPPs after use.
>>
>> Logs:
>> WARNING: at drivers/opp/core.c:1640 _opp_table_kref_release+0x150/0x158
>> Hardware name: Qualcomm Technologies, Inc. X1E80100 CRD (DT)
>> ...
>> Call trace:
>> _opp_table_kref_release+0x150/0x158
>> dev_pm_opp_remove_table+0x100/0x1b4
>> devm_pm_opp_of_table_release+0x10/0x1c
>> devm_action_release+0x14/0x20
>> devres_release_all+0xa4/0x104
>> device_unbind_cleanup+0x18/0x60
>> device_release_driver_internal+0x1ec/0x228
>> driver_detach+0x50/0x98
>> bus_remove_driver+0x6c/0xbc
>> driver_unregister+0x30/0x60
>> platform_driver_unregister+0x14/0x20
>> bwmon_driver_exit+0x18/0x524 [icc_bwmon]
>> __arm64_sys_delete_module+0x184/0x264
>> invoke_syscall+0x48/0x118
>> el0_svc_common.constprop.0+0xc8/0xe8
>> do_el0_svc+0x20/0x2c
>> el0_svc+0x34/0xdc
>> el0t_64_sync_handler+0x13c/0x158
>> el0t_64_sync+0x190/0x194
>> --[ end trace 0000000000000000 ]---
>>
>> Fixes: 0276f69f13e2 ("soc: qcom: icc-bwmon: Set default thresholds dynamically")
>> Fixes: b9c2ae6cac40 ("soc: qcom: icc-bwmon: Add bandwidth monitoring driver")
>> Signed-off-by: Sibi Sankar <quic_sibis@quicinc.com>
>> ---
> 
> Reviewed-by: Konrad Dybcio <konrad.dybcio@linaro.org>

Cc: stable@vger.kernel.org

Konrad
Bjorn Andersson June 21, 2024, 6:11 a.m. UTC | #3
On Thu, 13 Jun 2024 22:15:06 +0530, Sibi Sankar wrote:
> The following warning is seen during bwmon_remove due to refcount
> imbalance, fix this by releasing the OPPs after use.
> 
> Logs:
> WARNING: at drivers/opp/core.c:1640 _opp_table_kref_release+0x150/0x158
> Hardware name: Qualcomm Technologies, Inc. X1E80100 CRD (DT)
> ...
> Call trace:
> _opp_table_kref_release+0x150/0x158
> dev_pm_opp_remove_table+0x100/0x1b4
> devm_pm_opp_of_table_release+0x10/0x1c
> devm_action_release+0x14/0x20
> devres_release_all+0xa4/0x104
> device_unbind_cleanup+0x18/0x60
> device_release_driver_internal+0x1ec/0x228
> driver_detach+0x50/0x98
> bus_remove_driver+0x6c/0xbc
> driver_unregister+0x30/0x60
> platform_driver_unregister+0x14/0x20
> bwmon_driver_exit+0x18/0x524 [icc_bwmon]
> __arm64_sys_delete_module+0x184/0x264
> invoke_syscall+0x48/0x118
> el0_svc_common.constprop.0+0xc8/0xe8
> do_el0_svc+0x20/0x2c
> el0_svc+0x34/0xdc
> el0t_64_sync_handler+0x13c/0x158
> el0t_64_sync+0x190/0x194
> --[ end trace 0000000000000000 ]---
> 
> [...]

Applied, thanks!

[1/1] soc: qcom: icc-bwmon: Fix refcount imbalance seen during bwmon_remove
      commit: 24086640ab39396eb1a92d1cb1cd2f31b2677c52

Best regards,
diff mbox series

Patch

diff --git a/drivers/soc/qcom/icc-bwmon.c b/drivers/soc/qcom/icc-bwmon.c
index fb323b3364db..ecddb60bd665 100644
--- a/drivers/soc/qcom/icc-bwmon.c
+++ b/drivers/soc/qcom/icc-bwmon.c
@@ -565,7 +565,7 @@  static void bwmon_start(struct icc_bwmon *bwmon)
 	int window;
 
 	/* No need to check for errors, as this must have succeeded before. */
-	dev_pm_opp_find_bw_ceil(bwmon->dev, &bw_low, 0);
+	dev_pm_opp_put(dev_pm_opp_find_bw_ceil(bwmon->dev, &bw_low, 0));
 
 	bwmon_clear_counters(bwmon, true);
 
@@ -772,11 +772,13 @@  static int bwmon_probe(struct platform_device *pdev)
 	opp = dev_pm_opp_find_bw_floor(dev, &bwmon->max_bw_kbps, 0);
 	if (IS_ERR(opp))
 		return dev_err_probe(dev, PTR_ERR(opp), "failed to find max peak bandwidth\n");
+	dev_pm_opp_put(opp);
 
 	bwmon->min_bw_kbps = 0;
 	opp = dev_pm_opp_find_bw_ceil(dev, &bwmon->min_bw_kbps, 0);
 	if (IS_ERR(opp))
 		return dev_err_probe(dev, PTR_ERR(opp), "failed to find min peak bandwidth\n");
+	dev_pm_opp_put(opp);
 
 	bwmon->dev = dev;