dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/panfrost: Fix module unload
@ 2020-10-30 14:58 Steven Price
  2020-11-03  8:29 ` Tomeu Vizoso
  2020-11-03  8:45 ` Boris Brezillon
  0 siblings, 2 replies; 3+ messages in thread
From: Steven Price @ 2020-10-30 14:58 UTC (permalink / raw)
  To: Daniel Vetter, David Airlie, Rob Herring, Tomeu Vizoso
  Cc: linux-kernel, Boris Brezillon, Alyssa Rosenzweig, dri-devel,
	Steven Price

When unloading the call to pm_runtime_put_sync_suspend() will attempt to
turn the GPU cores off, however panfrost_device_fini() will have turned
the clocks off. This leads to the hardware locking up.

Instead don't call pm_runtime_put_sync_suspend() and instead simply mark
the device as suspended using pm_runtime_set_suspended(). And also
include this on the error path in panfrost_probe().

Fixes: aebe8c22a912 ("drm/panfrost: Fix possible suspend in panfrost_remove")
Signed-off-by: Steven Price <steven.price@arm.com>
---
 drivers/gpu/drm/panfrost/panfrost_drv.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 23513869500c..0ac8ad18fdc6 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -627,6 +627,7 @@ static int panfrost_probe(struct platform_device *pdev)
 err_out1:
 	pm_runtime_disable(pfdev->dev);
 	panfrost_device_fini(pfdev);
+	pm_runtime_set_suspended(pfdev->dev);
 err_out0:
 	drm_dev_put(ddev);
 	return err;
@@ -641,9 +642,9 @@ static int panfrost_remove(struct platform_device *pdev)
 	panfrost_gem_shrinker_cleanup(ddev);
 
 	pm_runtime_get_sync(pfdev->dev);
-	panfrost_device_fini(pfdev);
-	pm_runtime_put_sync_suspend(pfdev->dev);
 	pm_runtime_disable(pfdev->dev);
+	panfrost_device_fini(pfdev);
+	pm_runtime_set_suspended(pfdev->dev);
 
 	drm_dev_put(ddev);
 	return 0;
-- 
2.20.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/panfrost: Fix module unload
  2020-10-30 14:58 [PATCH] drm/panfrost: Fix module unload Steven Price
@ 2020-11-03  8:29 ` Tomeu Vizoso
  2020-11-03  8:45 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Tomeu Vizoso @ 2020-11-03  8:29 UTC (permalink / raw)
  To: Steven Price
  Cc: David Airlie, open list, dri-devel, Boris Brezillon, Alyssa Rosenzweig


[-- Attachment #1.1: Type: text/plain, Size: 1956 bytes --]

Looks good, thanks!

Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>

On Fri, 30 Oct 2020 at 15:59, Steven Price <steven.price@arm.com> wrote:

> When unloading the call to pm_runtime_put_sync_suspend() will attempt to
> turn the GPU cores off, however panfrost_device_fini() will have turned
> the clocks off. This leads to the hardware locking up.
>
> Instead don't call pm_runtime_put_sync_suspend() and instead simply mark
> the device as suspended using pm_runtime_set_suspended(). And also
> include this on the error path in panfrost_probe().
>
> Fixes: aebe8c22a912 ("drm/panfrost: Fix possible suspend in
> panfrost_remove")
> Signed-off-by: Steven Price <steven.price@arm.com>
> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c
> b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 23513869500c..0ac8ad18fdc6 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -627,6 +627,7 @@ static int panfrost_probe(struct platform_device *pdev)
>  err_out1:
>         pm_runtime_disable(pfdev->dev);
>         panfrost_device_fini(pfdev);
> +       pm_runtime_set_suspended(pfdev->dev);
>  err_out0:
>         drm_dev_put(ddev);
>         return err;
> @@ -641,9 +642,9 @@ static int panfrost_remove(struct platform_device
> *pdev)
>         panfrost_gem_shrinker_cleanup(ddev);
>
>         pm_runtime_get_sync(pfdev->dev);
> -       panfrost_device_fini(pfdev);
> -       pm_runtime_put_sync_suspend(pfdev->dev);
>         pm_runtime_disable(pfdev->dev);
> +       panfrost_device_fini(pfdev);
> +       pm_runtime_set_suspended(pfdev->dev);
>
>         drm_dev_put(ddev);
>         return 0;
> --
> 2.20.1
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
>

[-- Attachment #1.2: Type: text/html, Size: 2974 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/panfrost: Fix module unload
  2020-10-30 14:58 [PATCH] drm/panfrost: Fix module unload Steven Price
  2020-11-03  8:29 ` Tomeu Vizoso
@ 2020-11-03  8:45 ` Boris Brezillon
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Brezillon @ 2020-11-03  8:45 UTC (permalink / raw)
  To: Steven Price
  Cc: Tomeu Vizoso, David Airlie, linux-kernel, dri-devel, Alyssa Rosenzweig

On Fri, 30 Oct 2020 14:58:33 +0000
Steven Price <steven.price@arm.com> wrote:

> When unloading the call to pm_runtime_put_sync_suspend() will attempt to
> turn the GPU cores off, however panfrost_device_fini() will have turned
> the clocks off. This leads to the hardware locking up.
> 
> Instead don't call pm_runtime_put_sync_suspend() and instead simply mark
> the device as suspended using pm_runtime_set_suspended(). And also
> include this on the error path in panfrost_probe().
> 
> Fixes: aebe8c22a912 ("drm/panfrost: Fix possible suspend in panfrost_remove")
> Signed-off-by: Steven Price <steven.price@arm.com>

Queued to drm-misc-fixes.

Thanks,

Boris

> ---
>  drivers/gpu/drm/panfrost/panfrost_drv.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 23513869500c..0ac8ad18fdc6 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -627,6 +627,7 @@ static int panfrost_probe(struct platform_device *pdev)
>  err_out1:
>  	pm_runtime_disable(pfdev->dev);
>  	panfrost_device_fini(pfdev);
> +	pm_runtime_set_suspended(pfdev->dev);
>  err_out0:
>  	drm_dev_put(ddev);
>  	return err;
> @@ -641,9 +642,9 @@ static int panfrost_remove(struct platform_device *pdev)
>  	panfrost_gem_shrinker_cleanup(ddev);
>  
>  	pm_runtime_get_sync(pfdev->dev);
> -	panfrost_device_fini(pfdev);
> -	pm_runtime_put_sync_suspend(pfdev->dev);
>  	pm_runtime_disable(pfdev->dev);
> +	panfrost_device_fini(pfdev);
> +	pm_runtime_set_suspended(pfdev->dev);
>  
>  	drm_dev_put(ddev);
>  	return 0;

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-03  8:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-30 14:58 [PATCH] drm/panfrost: Fix module unload Steven Price
2020-11-03  8:29 ` Tomeu Vizoso
2020-11-03  8:45 ` Boris Brezillon

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).