[PATCH] drm/vc4: Shut down BO cache timer before teardown

Linmao Li posted 1 patch 4 days, 17 hours ago
drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] drm/vc4: Shut down BO cache timer before teardown
Posted by Linmao Li 4 days, 17 hours ago
The BO cache timer callback schedules time_work, and time_work can rearm
the timer through vc4_bo_cache_free_old().

vc4_bo_cache_destroy() deletes the timer and then cancels the work, which
does not break that cycle: the work being cancelled can rearm the timer,
and the timer then queues work again after teardown.

Use timer_shutdown_sync() instead, so the timer cannot be rearmed and the
cycle ends with cancel_work_sync().

Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.")
Cc: stable@vger.kernel.org
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
---
 drivers/gpu/drm/vc4/vc4_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 2161761b1f22..90a51bc31620 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -1044,7 +1044,7 @@ static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused)
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
 	int i;
 
-	timer_delete(&vc4->bo_cache.time_timer);
+	timer_shutdown_sync(&vc4->bo_cache.time_timer);
 	cancel_work_sync(&vc4->bo_cache.time_work);
 
 	vc4_bo_cache_purge(dev);
-- 
2.25.1
Re: [PATCH] drm/vc4: Shut down BO cache timer before teardown
Posted by Maíra Canal 1 day, 3 hours ago
On Mon, 20 Jul 2026 16:44:26 +0800, Linmao Li wrote:
> The BO cache timer callback schedules time_work, and time_work can rearm
> the timer through vc4_bo_cache_free_old().
> 
> vc4_bo_cache_destroy() deletes the timer and then cancels the work, which
> does not break that cycle: the work being cancelled can rearm the timer,
> and the timer then queues work again after teardown.
> 
> [...]

Applied, thanks!

[1/1] drm/vc4: Shut down BO cache timer before teardown
      commit: 6273dd3ffb54ec581855b82ae77331b66028249c

Best regards,
- Maíra