From: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: oded.gabbay@gmail.com, jeff.hugo@oss.qualcomm.com,
karol.wachowski@linux.intel.com, lizhi.hou@amd.com,
andrzej.kacprowski@linux.intel.com,
dawid.osuchowski@linux.intel.com,
Jozef Wludzik <jozef.wludzik@linux.intel.com>
Subject: [PATCH 3/3] accel/ivpu: Shorten bo_list_lock hold time in BO free
Date: Tue, 1 Dec 2026 16:01:50 +0100 [thread overview]
Message-ID: <20261201150150.653061-4-dawid.osuchowski@linux.intel.com> (raw)
In-Reply-To: <20261201150150.653061-1-dawid.osuchowski@linux.intel.com>
From: Jozef Wludzik <jozef.wludzik@linux.intel.com>
ivpu_gem_bo_free() held bo_list_lock across the whole BO unbind,
including MMU unmapping, TLB invalidation and DMA unmapping.
Unbind the BO under its reservation lock first, and take bo_list_lock
only around list_del() at the end. Context teardown can still find the
BO on the list until it is unbound, and the reservation lock serializes
the two unbind paths, so the context outlives any unbind in progress in
the free path.
Signed-off-by: Jozef Wludzik <jozef.wludzik@linux.intel.com>
Signed-off-by: Dawid Osuchowski <dawid.osuchowski@linux.intel.com>
---
drivers/accel/ivpu/ivpu_gem.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/accel/ivpu/ivpu_gem.c b/drivers/accel/ivpu/ivpu_gem.c
index 276f2a04aeda..d4250d8d576a 100644
--- a/drivers/accel/ivpu/ivpu_gem.c
+++ b/drivers/accel/ivpu/ivpu_gem.c
@@ -311,9 +311,6 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)
drm_WARN_ON(&vdev->drm, list_empty(&bo->bo_list_node));
- mutex_lock(&vdev->bo_list_lock);
- list_del(&bo->bo_list_node);
-
drm_WARN_ON(&vdev->drm, !drm_gem_is_imported(&bo->base.base) &&
!dma_resv_test_signaled(obj->resv, DMA_RESV_USAGE_READ));
drm_WARN_ON(&vdev->drm, ivpu_bo_size(bo) == 0);
@@ -323,6 +320,8 @@ static void ivpu_gem_bo_free(struct drm_gem_object *obj)
ivpu_bo_unbind_locked(bo);
ivpu_bo_unlock(bo);
+ mutex_lock(&vdev->bo_list_lock);
+ list_del(&bo->bo_list_node);
mutex_unlock(&vdev->bo_list_lock);
drm_WARN_ON(&vdev->drm, bo->mmu_mapped);
--
2.43.0
next prev parent reply other threads:[~2026-12-01 15:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 15:01 [PATCH 0/3] accel/ivpu: Remove ctx->lock on MMU context unmap Dawid Osuchowski
2026-12-01 15:01 ` [PATCH 1/3] accel/ivpu: Avoid taking the context lock when unmapping pages Dawid Osuchowski
2026-12-02 13:42 ` Andrzej Kacprowski
2026-12-01 15:01 ` [PATCH 2/3] accel/ivpu: Separate VA allocator locking from page-table locking Dawid Osuchowski
2026-12-02 13:43 ` Andrzej Kacprowski
2026-12-01 15:01 ` Dawid Osuchowski [this message]
2026-12-02 13:44 ` [PATCH 3/3] accel/ivpu: Shorten bo_list_lock hold time in BO free Andrzej Kacprowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201150150.653061-4-dawid.osuchowski@linux.intel.com \
--to=dawid.osuchowski@linux.intel.com \
--cc=andrzej.kacprowski@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=jeff.hugo@oss.qualcomm.com \
--cc=jozef.wludzik@linux.intel.com \
--cc=karol.wachowski@linux.intel.com \
--cc=lizhi.hou@amd.com \
--cc=oded.gabbay@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.