* [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
@ 2022-06-01 12:20 Miaoqian Lin
2022-06-01 13:26 ` Daniel Vetter
0 siblings, 1 reply; 8+ messages in thread
From: Miaoqian Lin @ 2022-06-01 12:20 UTC (permalink / raw)
To: Emma Anholt, David Airlie, Daniel Vetter, Eric Anholt, dri-devel,
linux-kernel
Cc: linmq006
The pm_runtime_enable will increase power disable depth.
If the probe fails, we should use pm_runtime_disable() to balance
pm_runtime_enable().
Also call disable function in remove function.
Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
Changes in v3:
- call pm_runtime_disable() in v3d_platform_drm_remove
- update commit message
Changes in v2
- put pm_runtime_disable before dma_free_wc
- rename dma_free to pm_disable
v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
---
drivers/gpu/drm/v3d/v3d_drv.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index 1afcd54fbbd5..f3380399fe17 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -286,7 +286,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
ret = v3d_gem_init(drm);
if (ret)
- goto dma_free;
+ goto pm_disable;
ret = v3d_irq_init(v3d);
if (ret)
@@ -302,7 +302,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
v3d_irq_disable(v3d);
gem_destroy:
v3d_gem_destroy(drm);
-dma_free:
+pm_disable:
+ pm_runtime_disable(dev);
dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
return ret;
}
@@ -316,6 +317,7 @@ static int v3d_platform_drm_remove(struct platform_device *pdev)
v3d_gem_destroy(drm);
+ pm_runtime_disable(&pdev->dev);
dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
v3d->mmu_scratch_paddr);
--
2.25.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
2022-06-01 12:20 [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance Miaoqian Lin
@ 2022-06-01 13:26 ` Daniel Vetter
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2022-06-01 13:26 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Emma Anholt, David Airlie, Daniel Vetter, Eric Anholt, dri-devel,
linux-kernel
On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> Also call disable function in remove function.
>
> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> Changes in v3:
> - call pm_runtime_disable() in v3d_platform_drm_remove
> - update commit message
>
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
>
> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
Maybe a bit late since we're at v3 already, but are there no devm_
functions here that would dtrt automatically? Or is there another reason
we can't use them?
-Daniel
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index 1afcd54fbbd5..f3380399fe17 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -286,7 +286,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
> ret = v3d_gem_init(drm);
> if (ret)
> - goto dma_free;
> + goto pm_disable;
>
> ret = v3d_irq_init(v3d);
> if (ret)
> @@ -302,7 +302,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_irq_disable(v3d);
> gem_destroy:
> v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> + pm_runtime_disable(dev);
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> return ret;
> }
> @@ -316,6 +317,7 @@ static int v3d_platform_drm_remove(struct platform_device *pdev)
>
> v3d_gem_destroy(drm);
>
> + pm_runtime_disable(&pdev->dev);
> dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
> v3d->mmu_scratch_paddr);
>
> --
> 2.25.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
@ 2022-06-01 13:26 ` Daniel Vetter
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Vetter @ 2022-06-01 13:26 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Emma Anholt, David Airlie, linux-kernel, dri-devel, Eric Anholt
On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
> The pm_runtime_enable will increase power disable depth.
> If the probe fails, we should use pm_runtime_disable() to balance
> pm_runtime_enable().
> Also call disable function in remove function.
>
> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> Changes in v3:
> - call pm_runtime_disable() in v3d_platform_drm_remove
> - update commit message
>
> Changes in v2
> - put pm_runtime_disable before dma_free_wc
> - rename dma_free to pm_disable
>
> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
Maybe a bit late since we're at v3 already, but are there no devm_
functions here that would dtrt automatically? Or is there another reason
we can't use them?
-Daniel
> ---
> drivers/gpu/drm/v3d/v3d_drv.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index 1afcd54fbbd5..f3380399fe17 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -286,7 +286,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>
> ret = v3d_gem_init(drm);
> if (ret)
> - goto dma_free;
> + goto pm_disable;
>
> ret = v3d_irq_init(v3d);
> if (ret)
> @@ -302,7 +302,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
> v3d_irq_disable(v3d);
> gem_destroy:
> v3d_gem_destroy(drm);
> -dma_free:
> +pm_disable:
> + pm_runtime_disable(dev);
> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
> return ret;
> }
> @@ -316,6 +317,7 @@ static int v3d_platform_drm_remove(struct platform_device *pdev)
>
> v3d_gem_destroy(drm);
>
> + pm_runtime_disable(&pdev->dev);
> dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
> v3d->mmu_scratch_paddr);
>
> --
> 2.25.1
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
2022-06-01 13:26 ` Daniel Vetter
(?)
@ 2022-06-01 13:55 ` Miaoqian Lin
2022-06-01 14:47 ` Thierry Reding
-1 siblings, 1 reply; 8+ messages in thread
From: Miaoqian Lin @ 2022-06-01 13:55 UTC (permalink / raw)
To: Emma Anholt, David Airlie, Eric Anholt, dri-devel, linux-kernel
Cc: Miaoqian Lin
Hi, Daniel
On 2022/6/1 21:26, Daniel Vetter wrote:
> On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
>> The pm_runtime_enable will increase power disable depth.
>> If the probe fails, we should use pm_runtime_disable() to balance
>> pm_runtime_enable().
>> Also call disable function in remove function.
>>
>> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
>> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
>> ---
>> Changes in v3:
>> - call pm_runtime_disable() in v3d_platform_drm_remove
>> - update commit message
>>
>> Changes in v2
>> - put pm_runtime_disable before dma_free_wc
>> - rename dma_free to pm_disable
>>
>> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
>> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
> Maybe a bit late since we're at v3 already, but are there no devm_
> functions here that would dtrt automatically?
Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
How do you think?
> Or is there another reason
> we can't use them?
> -Daniel
>> ---
>> drivers/gpu/drm/v3d/v3d_drv.c | 6 ++++--
>> 1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
>> index 1afcd54fbbd5..f3380399fe17 100644
>> --- a/drivers/gpu/drm/v3d/v3d_drv.c
>> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
>> @@ -286,7 +286,7 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>>
>> ret = v3d_gem_init(drm);
>> if (ret)
>> - goto dma_free;
>> + goto pm_disable;
>>
>> ret = v3d_irq_init(v3d);
>> if (ret)
>> @@ -302,7 +302,8 @@ static int v3d_platform_drm_probe(struct platform_device *pdev)
>> v3d_irq_disable(v3d);
>> gem_destroy:
>> v3d_gem_destroy(drm);
>> -dma_free:
>> +pm_disable:
>> + pm_runtime_disable(dev);
>> dma_free_wc(dev, 4096, v3d->mmu_scratch, v3d->mmu_scratch_paddr);
>> return ret;
>> }
>> @@ -316,6 +317,7 @@ static int v3d_platform_drm_remove(struct platform_device *pdev)
>>
>> v3d_gem_destroy(drm);
>>
>> + pm_runtime_disable(&pdev->dev);
>> dma_free_wc(v3d->drm.dev, 4096, v3d->mmu_scratch,
>> v3d->mmu_scratch_paddr);
>>
>> --
>> 2.25.1
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
2022-06-01 13:55 ` Miaoqian Lin
@ 2022-06-01 14:47 ` Thierry Reding
0 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2022-06-01 14:47 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Emma Anholt, David Airlie, Eric Anholt, dri-devel, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]
On Wed, Jun 01, 2022 at 09:55:02PM +0800, Miaoqian Lin wrote:
> Hi, Daniel
>
> On 2022/6/1 21:26, Daniel Vetter wrote:
> > On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
> >> The pm_runtime_enable will increase power disable depth.
> >> If the probe fails, we should use pm_runtime_disable() to balance
> >> pm_runtime_enable().
> >> Also call disable function in remove function.
> >>
> >> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> >> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> >> ---
> >> Changes in v3:
> >> - call pm_runtime_disable() in v3d_platform_drm_remove
> >> - update commit message
> >>
> >> Changes in v2
> >> - put pm_runtime_disable before dma_free_wc
> >> - rename dma_free to pm_disable
> >>
> >> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
> >> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
> > Maybe a bit late since we're at v3 already, but are there no devm_
> > functions here that would dtrt automatically?
>
> Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
>
> action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
>
> How do you think?
Looks like there's a devm_pm_runtime_enable() helper that does exactly
that. See commit b3636a3a2c51 ("PM: runtime: add devm_pm_runtime_enable
helper"). I haven't seen any large janitorial series yet for that, so
perhaps it's just not widely known yet.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
@ 2022-06-01 14:47 ` Thierry Reding
0 siblings, 0 replies; 8+ messages in thread
From: Thierry Reding @ 2022-06-01 14:47 UTC (permalink / raw)
To: Miaoqian Lin
Cc: David Airlie, Eric Anholt, dri-devel, Emma Anholt, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1549 bytes --]
On Wed, Jun 01, 2022 at 09:55:02PM +0800, Miaoqian Lin wrote:
> Hi, Daniel
>
> On 2022/6/1 21:26, Daniel Vetter wrote:
> > On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
> >> The pm_runtime_enable will increase power disable depth.
> >> If the probe fails, we should use pm_runtime_disable() to balance
> >> pm_runtime_enable().
> >> Also call disable function in remove function.
> >>
> >> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> >> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> >> ---
> >> Changes in v3:
> >> - call pm_runtime_disable() in v3d_platform_drm_remove
> >> - update commit message
> >>
> >> Changes in v2
> >> - put pm_runtime_disable before dma_free_wc
> >> - rename dma_free to pm_disable
> >>
> >> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
> >> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
> > Maybe a bit late since we're at v3 already, but are there no devm_
> > functions here that would dtrt automatically?
>
> Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
>
> action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
>
> How do you think?
Looks like there's a devm_pm_runtime_enable() helper that does exactly
that. See commit b3636a3a2c51 ("PM: runtime: add devm_pm_runtime_enable
helper"). I haven't seen any large janitorial series yet for that, so
perhaps it's just not widely known yet.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
2022-06-01 14:47 ` Thierry Reding
@ 2022-06-02 2:05 ` Miaoqian Lin
-1 siblings, 0 replies; 8+ messages in thread
From: Miaoqian Lin @ 2022-06-02 2:05 UTC (permalink / raw)
To: Thierry Reding
Cc: Emma Anholt, David Airlie, Eric Anholt, dri-devel, linux-kernel
Hi, Thierry
On 2022/6/1 22:47, Thierry Reding wrote:
> On Wed, Jun 01, 2022 at 09:55:02PM +0800, Miaoqian Lin wrote:
>> Hi, Daniel
>>
>> On 2022/6/1 21:26, Daniel Vetter wrote:
>>> On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
>>>> The pm_runtime_enable will increase power disable depth.
>>>> If the probe fails, we should use pm_runtime_disable() to balance
>>>> pm_runtime_enable().
>>>> Also call disable function in remove function.
>>>>
>>>> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
>>>> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
>>>> ---
>>>> Changes in v3:
>>>> - call pm_runtime_disable() in v3d_platform_drm_remove
>>>> - update commit message
>>>>
>>>> Changes in v2
>>>> - put pm_runtime_disable before dma_free_wc
>>>> - rename dma_free to pm_disable
>>>>
>>>> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
>>>> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
>>> Maybe a bit late since we're at v3 already, but are there no devm_
>>> functions here that would dtrt automatically?
>> Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
>>
>> action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
>>
>> How do you think?
> Looks like there's a devm_pm_runtime_enable() helper that does exactly
> that. See commit b3636a3a2c51 ("PM: runtime: add devm_pm_runtime_enable
> helper"). I haven't seen any large janitorial series yet for that, so
> perhaps it's just not widely known yet.
Great, very helpful. Thanks for your kind reminder.
> Thierry
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance
@ 2022-06-02 2:05 ` Miaoqian Lin
0 siblings, 0 replies; 8+ messages in thread
From: Miaoqian Lin @ 2022-06-02 2:05 UTC (permalink / raw)
To: Thierry Reding
Cc: David Airlie, Eric Anholt, dri-devel, Emma Anholt, linux-kernel
Hi, Thierry
On 2022/6/1 22:47, Thierry Reding wrote:
> On Wed, Jun 01, 2022 at 09:55:02PM +0800, Miaoqian Lin wrote:
>> Hi, Daniel
>>
>> On 2022/6/1 21:26, Daniel Vetter wrote:
>>> On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
>>>> The pm_runtime_enable will increase power disable depth.
>>>> If the probe fails, we should use pm_runtime_disable() to balance
>>>> pm_runtime_enable().
>>>> Also call disable function in remove function.
>>>>
>>>> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
>>>> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
>>>> ---
>>>> Changes in v3:
>>>> - call pm_runtime_disable() in v3d_platform_drm_remove
>>>> - update commit message
>>>>
>>>> Changes in v2
>>>> - put pm_runtime_disable before dma_free_wc
>>>> - rename dma_free to pm_disable
>>>>
>>>> v1: https://lore.kernel.org/r/20220105120442.14418-1-linmq006@gmail.com
>>>> v2: https://lore.kernel.org/r/20220106124657.32737-1-linmq006@gmail.com
>>> Maybe a bit late since we're at v3 already, but are there no devm_
>>> functions here that would dtrt automatically?
>> Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
>>
>> action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
>>
>> How do you think?
> Looks like there's a devm_pm_runtime_enable() helper that does exactly
> that. See commit b3636a3a2c51 ("PM: runtime: add devm_pm_runtime_enable
> helper"). I haven't seen any large janitorial series yet for that, so
> perhaps it's just not widely known yet.
Great, very helpful. Thanks for your kind reminder.
> Thierry
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-06-02 2:05 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-01 12:20 [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance Miaoqian Lin
2022-06-01 13:26 ` Daniel Vetter
2022-06-01 13:26 ` Daniel Vetter
2022-06-01 13:55 ` Miaoqian Lin
2022-06-01 14:47 ` Thierry Reding
2022-06-01 14:47 ` Thierry Reding
2022-06-02 2:05 ` Miaoqian Lin
2022-06-02 2:05 ` Miaoqian Lin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.