Skip to content

Commit 8ea6bb8

Browse files
icklejnikula
authored andcommitted
drm/i915/gt: Close race between cacheline_retire and free
If the cacheline may still be busy, atomically mark it for future release, and only if we can determine that it will never be used again, immediately free it. Closes: https://gitlab.freedesktop.org/drm/intel/issues/1392 Fixes: ebece75 ("drm/i915: Keep timeline HWSP allocated until idle across the system") Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Mika Kuoppala <[email protected]> Cc: Matthew Auld <[email protected]> Reviewed-by: Mika Kuoppala <[email protected]> Cc: <[email protected]> # v5.2+ Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 2d4bd97) Signed-off-by: Jani Nikula <[email protected]>
1 parent eafc2aa commit 8ea6bb8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/i915/gt/intel_timeline.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,15 @@ static void cacheline_release(struct intel_timeline_cacheline *cl)
192192

193193
static void cacheline_free(struct intel_timeline_cacheline *cl)
194194
{
195+
if (!i915_active_acquire_if_busy(&cl->active)) {
196+
__idle_cacheline_free(cl);
197+
return;
198+
}
199+
195200
GEM_BUG_ON(ptr_test_bit(cl->vaddr, CACHELINE_FREE));
196201
cl->vaddr = ptr_set_bit(cl->vaddr, CACHELINE_FREE);
197202

198-
if (i915_active_is_idle(&cl->active))
199-
__idle_cacheline_free(cl);
203+
i915_active_release(&cl->active);
200204
}
201205

202206
int intel_timeline_init(struct intel_timeline *timeline,

0 commit comments

Comments
 (0)