diff mbox series

[2/2] gpu: host1x: Fix refcount leak in buffer cache

Message ID 20220207131932.2164560-2-mperttunen@nvidia.com (mailing list archive)
State New, archived
Headers show
Series [1/2] gpu: host1x: Always return syncpoint value when waiting | expand

Commit Message

Mikko Perttunen Feb. 7, 2022, 1:19 p.m. UTC
The recently introduced buffer cache is causing cached BOs to leak, as
cache entries are dropped when a BO's refcount goes to zero but the
cache itself keeps a reference to each cache BO, causing a circular
reference.

Fix this by not taking a reference to the cached BOs within the cache
itself.

Fixes: 1f39b1dfa53c ("drm/tegra: Implement buffer object cache")
Signed-off-by: Mikko Perttunen <mperttunen@nvidia.com>
---
NOTE

As is, applying this patch reveals a BO refcounting issue in the
DC driver. A fix for that bug should be applied before applying
this patch. I believe Thierry will be posting a fix for that
shortly.
---
 drivers/gpu/host1x/bus.c | 3 ---
 1 file changed, 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index bdee16a0bb8e..66ba04501c94 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -938,9 +938,6 @@  struct host1x_bo_mapping *host1x_bo_pin(struct device *dev, struct host1x_bo *bo
 		mapping->cache = cache;
 
 		list_add_tail(&mapping->entry, &cache->mappings);
-
-		/* bump reference count to track the copy in the cache */
-		kref_get(&mapping->ref);
 	}
 
 unlock: