2017-08-02 20:32:58

by Eric Anholt

[permalink] [raw]
Subject: [PATCH 1/3] drm/vc4: Fix double destroy of the BO cache on teardown.

It's also destroyed from the top level vc4_drv.c initialization, which
is where the cache was actually initialized from.

This used to just involve duplicate del_timer() and cancel_work_sync()
being called, but it started causing kmalloc issues once we
double-freed the new BO label array.

Fixes: 1908a876f909 ("drm/vc4: Add an ioctl for labeling GEM BOs for summary stats")
Signed-off-by: Eric Anholt <[email protected]>
---
drivers/gpu/drm/vc4/vc4_gem.c | 2 --
1 file changed, 2 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
index 209fccd0d3b4..892a031a3ced 100644
--- a/drivers/gpu/drm/vc4/vc4_gem.c
+++ b/drivers/gpu/drm/vc4/vc4_gem.c
@@ -1117,6 +1117,4 @@ vc4_gem_destroy(struct drm_device *dev)

if (vc4->hang_state)
vc4_free_hang_state(dev, vc4->hang_state);
-
- vc4_bo_cache_destroy(dev);
}
--
2.13.3


2017-08-02 20:32:47

by Eric Anholt

[permalink] [raw]
Subject: [PATCH 3/3] drm/vc4: Fix errant drm_bridge_remove() in DSI.

drm_bridge_remove() is for unregistering a bridge driver, not for
detaching a bridge from its consumer.

Fixes: 656fa22f9cea ("drm/vc4: Switch DSI to the panel-bridge layer, and support bridges.")
Signed-off-by: Eric Anholt <[email protected]>
---
drivers/gpu/drm/vc4/vc4_dsi.c | 1 -
1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 13481bb6322f..d1e0dc908048 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -1636,7 +1636,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,

pm_runtime_disable(dev);

- drm_bridge_remove(dsi->bridge);
vc4_dsi_encoder_destroy(dsi->encoder);

mipi_dsi_host_unregister(&dsi->dsi_host);
--
2.13.3

2017-08-02 20:33:11

by Eric Anholt

[permalink] [raw]
Subject: [PATCH 2/3] drm/vc4: Don't disable DSI clocks on component unload.

The clocks are enabled/disabled at encoder enable/disable time, not at
component load. Fixes a WARN_ON at boot if V3D fails to probe.

Fixes: 4078f5757144 ("drm/vc4: Add DSI driver")
Signed-off-by: Eric Anholt <[email protected]>
---
drivers/gpu/drm/vc4/vc4_dsi.c | 3 ---
1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
index 629d372633e6..13481bb6322f 100644
--- a/drivers/gpu/drm/vc4/vc4_dsi.c
+++ b/drivers/gpu/drm/vc4/vc4_dsi.c
@@ -1641,9 +1641,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,

mipi_dsi_host_unregister(&dsi->dsi_host);

- clk_disable_unprepare(dsi->pll_phy_clock);
- clk_disable_unprepare(dsi->escape_clock);
-
if (dsi->port == 1)
vc4->dsi1 = NULL;
}
--
2.13.3

2017-08-02 20:53:26

by Noralf Trønnes

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/vc4: Fix double destroy of the BO cache on teardown.


Den 02.08.2017 22.32, skrev Eric Anholt:
> It's also destroyed from the top level vc4_drv.c initialization, which
> is where the cache was actually initialized from.
>
> This used to just involve duplicate del_timer() and cancel_work_sync()
> being called, but it started causing kmalloc issues once we
> double-freed the new BO label array.
>
> Fixes: 1908a876f909 ("drm/vc4: Add an ioctl for labeling GEM BOs for summary stats")
> Signed-off-by: Eric Anholt <[email protected]>
> ---
> drivers/gpu/drm/vc4/vc4_gem.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index 209fccd0d3b4..892a031a3ced 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -1117,6 +1117,4 @@ vc4_gem_destroy(struct drm_device *dev)
>
> if (vc4->hang_state)
> vc4_free_hang_state(dev, vc4->hang_state);
> -
> - vc4_bo_cache_destroy(dev);
> }

I don't have a display connected, but there's no crashing anymore.

Tested-by: Noralf Trønnes <[email protected]>
Acked-by: Noralf Trønnes <[email protected]>


2017-08-03 13:37:56

by Noralf Trønnes

[permalink] [raw]
Subject: Re: [PATCH 2/3] drm/vc4: Don't disable DSI clocks on component unload.


Den 02.08.2017 22.32, skrev Eric Anholt:
> The clocks are enabled/disabled at encoder enable/disable time, not at
> component load. Fixes a WARN_ON at boot if V3D fails to probe.
>
> Fixes: 4078f5757144 ("drm/vc4: Add DSI driver")
> Signed-off-by: Eric Anholt <[email protected]>
> ---

Acked-by: Noralf Trønnes <[email protected]>

> drivers/gpu/drm/vc4/vc4_dsi.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index 629d372633e6..13481bb6322f 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -1641,9 +1641,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
>
> mipi_dsi_host_unregister(&dsi->dsi_host);
>
> - clk_disable_unprepare(dsi->pll_phy_clock);
> - clk_disable_unprepare(dsi->escape_clock);
> -
> if (dsi->port == 1)
> vc4->dsi1 = NULL;
> }

2017-08-03 13:38:09

by Noralf Trønnes

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/vc4: Fix errant drm_bridge_remove() in DSI.


Den 02.08.2017 22.32, skrev Eric Anholt:
> drm_bridge_remove() is for unregistering a bridge driver, not for
> detaching a bridge from its consumer.
>
> Fixes: 656fa22f9cea ("drm/vc4: Switch DSI to the panel-bridge layer, and support bridges.")
> Signed-off-by: Eric Anholt <[email protected]>
> ---

Acked-by: Noralf Trønnes <[email protected]>

> drivers/gpu/drm/vc4/vc4_dsi.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index 13481bb6322f..d1e0dc908048 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -1636,7 +1636,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
>
> pm_runtime_disable(dev);
>
> - drm_bridge_remove(dsi->bridge);
> vc4_dsi_encoder_destroy(dsi->encoder);
>
> mipi_dsi_host_unregister(&dsi->dsi_host);

2017-08-04 10:01:48

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 1/3] drm/vc4: Fix double destroy of the BO cache on teardown.

On Wed, 2 Aug 2017 13:32:40 -0700
Eric Anholt <[email protected]> wrote:

> It's also destroyed from the top level vc4_drv.c initialization, which
> is where the cache was actually initialized from.
>
> This used to just involve duplicate del_timer() and cancel_work_sync()
> being called, but it started causing kmalloc issues once we
> double-freed the new BO label array.
>
> Fixes: 1908a876f909 ("drm/vc4: Add an ioctl for labeling GEM BOs for summary stats")
> Signed-off-by: Eric Anholt <[email protected]>

Reviewed-by: Boris Brezillon <[email protected]>

> ---
> drivers/gpu/drm/vc4/vc4_gem.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_gem.c b/drivers/gpu/drm/vc4/vc4_gem.c
> index 209fccd0d3b4..892a031a3ced 100644
> --- a/drivers/gpu/drm/vc4/vc4_gem.c
> +++ b/drivers/gpu/drm/vc4/vc4_gem.c
> @@ -1117,6 +1117,4 @@ vc4_gem_destroy(struct drm_device *dev)
>
> if (vc4->hang_state)
> vc4_free_hang_state(dev, vc4->hang_state);
> -
> - vc4_bo_cache_destroy(dev);
> }

2017-08-04 10:02:44

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 2/3] drm/vc4: Don't disable DSI clocks on component unload.

On Wed, 2 Aug 2017 13:32:41 -0700
Eric Anholt <[email protected]> wrote:

> The clocks are enabled/disabled at encoder enable/disable time, not at
> component load. Fixes a WARN_ON at boot if V3D fails to probe.
>
> Fixes: 4078f5757144 ("drm/vc4: Add DSI driver")
> Signed-off-by: Eric Anholt <[email protected]>

Reviewed-by: Boris Brezillon <[email protected]>

> ---
> drivers/gpu/drm/vc4/vc4_dsi.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index 629d372633e6..13481bb6322f 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -1641,9 +1641,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
>
> mipi_dsi_host_unregister(&dsi->dsi_host);
>
> - clk_disable_unprepare(dsi->pll_phy_clock);
> - clk_disable_unprepare(dsi->escape_clock);
> -
> if (dsi->port == 1)
> vc4->dsi1 = NULL;
> }

2017-08-04 10:08:18

by Boris Brezillon

[permalink] [raw]
Subject: Re: [PATCH 3/3] drm/vc4: Fix errant drm_bridge_remove() in DSI.

On Wed, 2 Aug 2017 13:32:42 -0700
Eric Anholt <[email protected]> wrote:

> drm_bridge_remove() is for unregistering a bridge driver, not for

s/driver/device/

> detaching a bridge from its consumer.
>
> Fixes: 656fa22f9cea ("drm/vc4: Switch DSI to the panel-bridge layer, and support bridges.")
> Signed-off-by: Eric Anholt <[email protected]>

Reviewed-by: Boris Brezillon <[email protected]>

> ---
> drivers/gpu/drm/vc4/vc4_dsi.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/vc4/vc4_dsi.c b/drivers/gpu/drm/vc4/vc4_dsi.c
> index 13481bb6322f..d1e0dc908048 100644
> --- a/drivers/gpu/drm/vc4/vc4_dsi.c
> +++ b/drivers/gpu/drm/vc4/vc4_dsi.c
> @@ -1636,7 +1636,6 @@ static void vc4_dsi_unbind(struct device *dev, struct device *master,
>
> pm_runtime_disable(dev);
>
> - drm_bridge_remove(dsi->bridge);
> vc4_dsi_encoder_destroy(dsi->encoder);
>
> mipi_dsi_host_unregister(&dsi->dsi_host);