Skip to contentSkip to conversation

drm/vc4: Fix double destroy of the BO cache on teardown.

PATCH In review Eric Anholt 3 participants 9 messages Aug 2, 2017 – Aug 4, 2017

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

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")
---
 drivers/gpu/drm/vc4/vc4_gem.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +0 -2
index 209fccd0d3b4..892a031a3ced 100644
@@ -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);
 }
Signature · 6 lines
2.13.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#1 lore raw

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")
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/vc4/vc4_dsi.c +0 -3
index 629d372633e6..13481bb6322f 100644
@@ -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;
 }
Signature · 6 lines
2.13.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 2/3
#2 lore raw

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

Den 02.08.2017 22.32, skrev Eric Anholt:

Quoted 6 lines

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

---

Quoted 17 lines
  drivers/gpu/drm/vc4/vc4_dsi.c | 3 ---
  1 file changed, 3 deletions(-)
drivers/gpu/drm/vc4/vc4_dsi.c +0 -3
index 629d372633e6..13481bb6322f 100644
@@ -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;
  }
Reviewed-by on v1 2/3
#3 lore raw

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

In reply to Eric Anholt
Quoted 5 lines · 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")
Quoted 9 lines
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 3 ---
 1 file changed, 3 deletions(-)
drivers/gpu/drm/vc4/vc4_dsi.c +0 -0
index 629d372633e6..13481bb6322f 100644

drivers/gpu/drm/vc4/vc4_dsi.c static void vc4_dsi_unbind(struct device *dev, struct device *master, · line 1646

Quoted 9 lines
drivers/gpu/drm/vc4/vc4_dsi.c +0 -3
@@ -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;
 }

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#4 lore raw

PATCH 3/3 drm/vc4: Fix errant drm_bridge_remove() in DSI.

In reply to 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.")
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dsi.c +0 -1
index 13481bb6322f..d1e0dc908048 100644
@@ -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);
Signature · 6 lines
2.13.3

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 3/3
#5 lore raw

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

Den 02.08.2017 22.32, skrev Eric Anholt:

Quoted 6 lines

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

---

Quoted 15 lines
  drivers/gpu/drm/vc4/vc4_dsi.c | 1 -
  1 file changed, 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dsi.c +0 -1
index 13481bb6322f..d1e0dc908048 100644
@@ -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);
Reviewed-by on v1 3/3
#6 lore raw

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

In reply to Eric Anholt
Quoted 1 line · 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/

Quoted 4 lines

detaching a bridge from its consumer.

Fixes 656fa22f9cea ("drm/vc4: Switch DSI to the panel-bridge layer, and support bridges.")
Quoted 16 lines
---
 drivers/gpu/drm/vc4/vc4_dsi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/gpu/drm/vc4/vc4_dsi.c +0 -1
index 13481bb6322f..d1e0dc908048 100644
@@ -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);
Tested-by Acked-by on v1 1/3
#7 lore raw
In reply to Eric Anholt

Den 02.08.2017 22.32, skrev Eric Anholt:

Quoted 18 lines

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")
---
  drivers/gpu/drm/vc4/vc4_gem.c | 2 --
  1 file changed, 2 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +0 -0
index 209fccd0d3b4..892a031a3ced 100644

drivers/gpu/drm/vc4/vc4_gem.c vc4_gem_destroy(struct drm_device *dev) · line 1120

Quoted 6 lines
drivers/gpu/drm/vc4/vc4_gem.c +0 -2
@@ -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.

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/3
#8 lore raw
In reply to Eric Anholt
Quoted 9 lines · 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")
Quoted 9 lines
---
 drivers/gpu/drm/vc4/vc4_gem.c | 2 --
 1 file changed, 2 deletions(-)
drivers/gpu/drm/vc4/vc4_gem.c +0 -0
index 209fccd0d3b4..892a031a3ced 100644

drivers/gpu/drm/vc4/vc4_gem.c vc4_gem_destroy(struct drm_device *dev) · line 1120

Quoted 6 lines
drivers/gpu/drm/vc4/vc4_gem.c +0 -2
@@ -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);
 }

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel