* [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe
@ 2020-06-24 6:30 Dinghao Liu
2020-06-25 15:52 ` Stanimir Varbanov
0 siblings, 1 reply; 6+ messages in thread
From: Dinghao Liu @ 2020-06-24 6:30 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Stanimir Varbanov, Andy Gross, Bjorn Andersson,
Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel
pm_runtime_get_sync() increments the runtime PM usage counter even
when it returns an error code. Thus a pairing decrement is needed on
the error handling path to keep the counter balanced. For other error
paths after this call, things are the same.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
Changelog:
v2: - Add pm_runtime_get_noresume() on failure of
pm_runtime_put_sync() to balance PM counter instead of
releasing everything here.
---
drivers/media/platform/qcom/venus/core.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
index 203c6538044f..b0b932bf8c02 100644
--- a/drivers/media/platform/qcom/venus/core.c
+++ b/drivers/media/platform/qcom/venus/core.c
@@ -287,8 +287,10 @@ static int venus_probe(struct platform_device *pdev)
goto err_core_deinit;
ret = pm_runtime_put_sync(dev);
- if (ret)
+ if (ret) {
+ pm_runtime_get_noresume(dev);
goto err_dev_unregister;
+ }
return 0;
@@ -299,6 +301,7 @@ static int venus_probe(struct platform_device *pdev)
err_venus_shutdown:
venus_shutdown(core);
err_runtime_disable:
+ pm_runtime_put_noidle(dev);
pm_runtime_set_suspended(dev);
pm_runtime_disable(dev);
hfi_destroy(core);
--
2.17.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe
2020-06-24 6:30 [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe Dinghao Liu
@ 2020-06-25 15:52 ` Stanimir Varbanov
2020-06-26 0:54 ` dinghao.liu
0 siblings, 1 reply; 6+ messages in thread
From: Stanimir Varbanov @ 2020-06-25 15:52 UTC (permalink / raw)
To: Dinghao Liu, kjlu
Cc: Stanimir Varbanov, Andy Gross, Bjorn Andersson,
Mauro Carvalho Chehab, linux-media, linux-arm-msm, linux-kernel
Hi Dinghao,
On 6/24/20 9:30 AM, Dinghao Liu wrote:
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced. For other error
> paths after this call, things are the same.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>
> Changelog:
>
> v2: - Add pm_runtime_get_noresume() on failure of
> pm_runtime_put_sync() to balance PM counter instead of
> releasing everything here.
You are adding pm_runtime_get_noresume in pm_runtime_put_sync error path
but the patch description is referring to pm_runtime_get_sync. I'm confused.
> ---
> drivers/media/platform/qcom/venus/core.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> index 203c6538044f..b0b932bf8c02 100644
> --- a/drivers/media/platform/qcom/venus/core.c
> +++ b/drivers/media/platform/qcom/venus/core.c
> @@ -287,8 +287,10 @@ static int venus_probe(struct platform_device *pdev)
> goto err_core_deinit;
>
> ret = pm_runtime_put_sync(dev);
> - if (ret)
> + if (ret) {
> + pm_runtime_get_noresume(dev);
> goto err_dev_unregister;
> + }
>
> return 0;
>
> @@ -299,6 +301,7 @@ static int venus_probe(struct platform_device *pdev)
> err_venus_shutdown:
> venus_shutdown(core);
> err_runtime_disable:
> + pm_runtime_put_noidle(dev);
> pm_runtime_set_suspended(dev);
> pm_runtime_disable(dev);
> hfi_destroy(core);
>
--
regards,
Stan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe
2020-06-25 15:52 ` Stanimir Varbanov
@ 2020-06-26 0:54 ` dinghao.liu
2020-06-26 21:01 ` Stanimir Varbanov
0 siblings, 1 reply; 6+ messages in thread
From: dinghao.liu @ 2020-06-26 0:54 UTC (permalink / raw)
To: Stanimir Varbanov
Cc: kjlu, Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab,
linux-media, linux-arm-msm, linux-kernel
> Hi Dinghao,
>
> On 6/24/20 9:30 AM, Dinghao Liu wrote:
> > pm_runtime_get_sync() increments the runtime PM usage counter even
> > when it returns an error code. Thus a pairing decrement is needed on
> > the error handling path to keep the counter balanced. For other error
> > paths after this call, things are the same.
> >
> > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> > ---
> >
> > Changelog:
> >
> > v2: - Add pm_runtime_get_noresume() on failure of
> > pm_runtime_put_sync() to balance PM counter instead of
> > releasing everything here.
>
> You are adding pm_runtime_get_noresume in pm_runtime_put_sync error path
> but the patch description is referring to pm_runtime_get_sync. I'm confused.
>
When pm_runtime_put_sync failed, the control flow will jump to
err_dev_unregister, where has already been a pm_runtime_put_noidle.
If we don't add an extra pm_runtime_get_noresume here, we will
decrease PM usage counter twice.
Anyway, this may seem a little strange. Do you have a better
strategy to reorder the labels?
Regards,
Dinghao
> > ---
> > drivers/media/platform/qcom/venus/core.c | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
> > index 203c6538044f..b0b932bf8c02 100644
> > --- a/drivers/media/platform/qcom/venus/core.c
> > +++ b/drivers/media/platform/qcom/venus/core.c
> > @@ -287,8 +287,10 @@ static int venus_probe(struct platform_device *pdev)
> > goto err_core_deinit;
> >
> > ret = pm_runtime_put_sync(dev);
> > - if (ret)
> > + if (ret) {
> > + pm_runtime_get_noresume(dev);
> > goto err_dev_unregister;
> > + }
> >
> > return 0;
> >
> > @@ -299,6 +301,7 @@ static int venus_probe(struct platform_device *pdev)
> > err_venus_shutdown:
> > venus_shutdown(core);
> > err_runtime_disable:
> > + pm_runtime_put_noidle(dev);
> > pm_runtime_set_suspended(dev);
> > pm_runtime_disable(dev);
> > hfi_destroy(core);
> >
>
> --
> regards,
> Stan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe
2020-06-26 0:54 ` dinghao.liu
@ 2020-06-26 21:01 ` Stanimir Varbanov
2020-06-28 5:38 ` dinghao.liu
0 siblings, 1 reply; 6+ messages in thread
From: Stanimir Varbanov @ 2020-06-26 21:01 UTC (permalink / raw)
To: dinghao.liu
Cc: kjlu, Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab,
linux-media, linux-arm-msm, linux-kernel
Hi,
On 6/26/20 3:54 AM, dinghao.liu@zju.edu.cn wrote:
>
>> Hi Dinghao,
>>
>> On 6/24/20 9:30 AM, Dinghao Liu wrote:
>>> pm_runtime_get_sync() increments the runtime PM usage counter even
>>> when it returns an error code. Thus a pairing decrement is needed on
>>> the error handling path to keep the counter balanced. For other error
>>> paths after this call, things are the same.
>>>
>>> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
>>> ---
>>>
>>> Changelog:
>>>
>>> v2: - Add pm_runtime_get_noresume() on failure of
>>> pm_runtime_put_sync() to balance PM counter instead of
>>> releasing everything here.
Could you reword this and add it to the patch description.
>>
>> You are adding pm_runtime_get_noresume in pm_runtime_put_sync error path
>> but the patch description is referring to pm_runtime_get_sync. I'm confused.
>>
>
> When pm_runtime_put_sync failed, the control flow will jump to
> err_dev_unregister, where has already been a pm_runtime_put_noidle.
> If we don't add an extra pm_runtime_get_noresume here, we will
> decrease PM usage counter twice.
>
> Anyway, this may seem a little strange. Do you have a better
> strategy to reorder the labels?
No, it looks fine. With above addition to patch description:
Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>
>
> Regards,
> Dinghao
>
>>> ---
>>> drivers/media/platform/qcom/venus/core.c | 5 ++++-
>>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c
>>> index 203c6538044f..b0b932bf8c02 100644
>>> --- a/drivers/media/platform/qcom/venus/core.c
>>> +++ b/drivers/media/platform/qcom/venus/core.c
>>> @@ -287,8 +287,10 @@ static int venus_probe(struct platform_device *pdev)
>>> goto err_core_deinit;
>>>
>>> ret = pm_runtime_put_sync(dev);
>>> - if (ret)
>>> + if (ret) {
>>> + pm_runtime_get_noresume(dev);
>>> goto err_dev_unregister;
>>> + }
>>>
>>> return 0;
>>>
>>> @@ -299,6 +301,7 @@ static int venus_probe(struct platform_device *pdev)
>>> err_venus_shutdown:
>>> venus_shutdown(core);
>>> err_runtime_disable:
>>> + pm_runtime_put_noidle(dev);
>>> pm_runtime_set_suspended(dev);
>>> pm_runtime_disable(dev);
>>> hfi_destroy(core);
>>>
>>
>> --
>> regards,
>> Stan
--
regards,
Stan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Re: [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe
2020-06-26 21:01 ` Stanimir Varbanov
@ 2020-06-28 5:38 ` dinghao.liu
0 siblings, 0 replies; 6+ messages in thread
From: dinghao.liu @ 2020-06-28 5:38 UTC (permalink / raw)
To: Stanimir Varbanov
Cc: kjlu, Andy Gross, Bjorn Andersson, Mauro Carvalho Chehab,
linux-media, linux-arm-msm, linux-kernel
>
> Could you reword this and add it to the patch description.
>
Fine. I will fix this in the next version of patch.
Regards,
Dinghao
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] media: venus: core: Fix runtime PM imbalance in venus_probe
@ 2020-06-24 15:25 Markus Elfring
0 siblings, 0 replies; 6+ messages in thread
From: Markus Elfring @ 2020-06-24 15:25 UTC (permalink / raw)
To: Dinghao Liu, linux-arm-msm, linux-media
Cc: kernel-janitors, linux-kernel, Aditya Pakki, Navid Emamdoost,
Kangjie Lu, Qiushi Wu, Andy Gross, Mauro Carvalho Chehab,
Stanimir Varbanov, Bjorn Andersson
I propose to combine two tags in the previous patch subject.
> pm_runtime_get_sync() increments the runtime PM usage counter even
> when it returns an error code. Thus a pairing decrement is needed on
> the error handling path to keep the counter balanced. For other error
> paths after this call, things are the same.
How do you think about a wording variant like the following?
Change description:
The PM runtime usage counter is incremented even if a call of
the function “pm_runtime_get_sync” failed. Thus decrement it also
in error cases so that the reference counting is kept consistent.
Add also a call of the function “pm_runtime_get_noresume”
in one if branch for the completion of the desired exception handling.
Would you like to add the tag “Fixes” to the commit message?
Regards,
Markus
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-06-28 5:38 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24 6:30 [PATCH] [v2] media: venus: core: Fix runtime PM imbalance in venus_probe Dinghao Liu
2020-06-25 15:52 ` Stanimir Varbanov
2020-06-26 0:54 ` dinghao.liu
2020-06-26 21:01 ` Stanimir Varbanov
2020-06-28 5:38 ` dinghao.liu
2020-06-24 15:25 [PATCH v2] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).