[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20260123073358.1530418-1-black.hawk@163.com>
Date: Fri, 23 Jan 2026 15:33:58 +0800
From: Rahul Sharma <black.hawk@....com>
To: gregkh@...uxfoundation.org,
stable@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Tomasz Rusinowicz <tomasz.rusinowicz@...el.com>,
Jeff Hugo <jeff.hugo@....qualcomm.com>,
Karol Wachowski <karol.wachowski@...ux.intel.com>,
Rahul Sharma <black.hawk@....com>
Subject: [PATCH v6.12] accel/ivpu: Fix race condition when unbinding BOs
From: Tomasz Rusinowicz <tomasz.rusinowicz@...el.com>
[ Upstream commit 00812636df370bedf4e44a0c81b86ea96bca8628 ]
Fix 'Memory manager not clean during takedown' warning that occurs
when ivpu_gem_bo_free() removes the BO from the BOs list before it
gets unmapped. Then file_priv_unbind() triggers a warning in
drm_mm_takedown() during context teardown.
Protect the unmapping sequence with bo_list_lock to ensure the BO is
always fully unmapped when removed from the list. This ensures the BO
is either fully unmapped at context teardown time or present on the
list and unmapped by file_priv_unbind().
Fixes: 48aea7f2a2ef ("accel/ivpu: Fix locking in ivpu_bo_remove_all_bos_from_context()")
Signed-off-by: Tomasz Rusinowicz <tomasz.rusinowicz@...el.com>
Reviewed-by: Jeff Hugo <jeff.hugo@....qualcomm.com>
Signed-off-by: Karol Wachowski <karol.wachowski@...ux.intel.com>
Link: https://patch.msgid.link/20251029071451.184243-1-karol.wachowski@linux.intel.com
[ The context change is due to the commit e0c0891cd63b
("accel/ivpu: Rework bind/unbind of imported buffers")
and the proper adoption is done. ]
Signed-off-by: Rahul Sharma <black.hawk@....com>
---
drivers/accel/ivpu/ivpu_gem.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 6b1bda7e130d..b4213e63afb4 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -240,7 +240,6 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)
mutex_lock(&vdev->bo_list_lock);
list_del(&bo->bo_list_node);
- mutex_unlock(&vdev->bo_list_lock);
drm_WARN_ON(&vdev->drm, !drm_gem_is_imported(&bo->base.base) &&
!dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ));
@@ -248,6 +247,8 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)
drm_WARN_ON(&vdev->drm, bo->base.vaddr);
ivpu_bo_unbind_locked(bo);
+ mutex_unlock(&vdev->bo_list_lock);
+
drm_WARN_ON(&vdev->drm, bo->mmu_mapped);
drm_WARN_ON(&vdev->drm, bo->ctx);
--
2.34.1
Powered by blists - more mailing lists