Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/i915/gt: Close race between cacheline_retire and free" failed to apply to 5.4-stable tree

PATCH [email protected] 1 participant 1 message Mar 16, 2020

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

The patch below does not apply to the 5.4-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 8ea6bb8e4d47e07518e5dba4f5cb77e210f0df82 Mon Sep 17 00:00:00 2001
From: Chris Wilson <[email protected]>
Date: Fri, 6 Mar 2020 15:46:47 +0000
Subject: [PATCH] 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.

Fixes ebece7539242 ("drm/i915: Keep timeline HWSP allocated until idle across the system")
Cc Tvrtko Ursulin <[email protected]>
Cc Mika Kuoppala <[email protected]>
Cc Matthew Auld <[email protected]>
Cc <[email protected]> # v5.2+
(cherry picked from commit 2d4bd971f5baa51418625f379a69f5d58b5a0450)
drivers/gpu/drm/i915/gt/intel_timeline.c +6 -2
index 87716529cd2f..d8d9f1179c2b 100644
@@ -192,11 +192,15 @@ static void cacheline_release(struct intel_timeline_cacheline *cl)
 
 static void cacheline_free(struct intel_timeline_cacheline *cl)
 {
+	if (!i915_active_acquire_if_busy(&cl->active)) {
+		__idle_cacheline_free(cl);
+		return;
+	}
+
 	GEM_BUG_ON(ptr_test_bit(cl->vaddr, CACHELINE_FREE));
 	cl->vaddr = ptr_set_bit(cl->vaddr, CACHELINE_FREE);
 
-	if (i915_active_is_idle(&cl->active))
-		__idle_cacheline_free(cl);
+	i915_active_release(&cl->active);
 }
 
 int intel_timeline_init(struct intel_timeline *timeline,