From cfc2c8b7bac86f26aca270bce94189bd3b63f535 Mon Sep 17 00:00:00 2001 From: riastradh Date: Mon, 14 Feb 2022 20:37:51 +0000 Subject: [PATCH] i915: Defer final wakeup on active until after retirement. Not sure what I was thinking when I moved this earlier! --- sys/external/bsd/drm2/dist/drm/i915/i915_active.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/external/bsd/drm2/dist/drm/i915/i915_active.c b/sys/external/bsd/drm2/dist/drm/i915/i915_active.c index c01dff2f8b21..2ba7203283e5 100644 --- a/sys/external/bsd/drm2/dist/drm/i915/i915_active.c +++ b/sys/external/bsd/drm2/dist/drm/i915/i915_active.c @@ -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 -__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 @@ -195,8 +195,6 @@ __active_retire(struct i915_active *ref) #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 @@ __active_retire(struct i915_active *ref) 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));