Mon Feb 14 20:37:51 2022 UTC ()
i915: Defer final wakeup on active until after retirement.

Not sure what I was thinking when I moved this earlier!


(riastradh)
diff -r1.10 -r1.11 src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c

cvs diff -r1.10 -r1.11 src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c (expand / switch to context diff)
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c 2021/12/24 00:14:03 1.10
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_active.c 2022/02/14 20:37:51 1.11
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_active.c,v 1.10 2021/12/24 00:14:03 riastradh Exp $	*/
+/*	$NetBSD: i915_active.c,v 1.11 2022/02/14 20:37:51 riastradh Exp $	*/
 
 /*
  * SPDX-License-Identifier: MIT
@@ -7,7 +7,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i915_active.c,v 1.10 2021/12/24 00:14:03 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i915_active.c,v 1.11 2022/02/14 20:37:51 riastradh Exp $");
 
 #include <linux/debugobjects.h>
 
@@ -195,8 +195,6 @@
 #endif
 	ref->cache = NULL;
 
-	DRM_SPIN_WAKEUP_ALL(&ref->tree_wq, &ref->tree_lock);
-
 	spin_unlock_irqrestore(&ref->tree_lock, flags);
 
 	/* After the final retire, the entire struct may be freed */
@@ -204,6 +202,9 @@
 		ref->retire(ref);
 
 	/* ... except if you wait on it, you must manage your own references! */
+	spin_lock(&ref->tree_lock);
+	DRM_SPIN_WAKEUP_ALL(&ref->tree_wq, &ref->tree_lock);
+	spin_unlock(&ref->tree_lock);
 
 	rbtree_postorder_for_each_entry_safe(it, n, &root, node) {
 		GEM_BUG_ON(i915_active_fence_isset(&it->base));