[PATCH 03/24] drm/i915: Only activate i915_active debugobject once

Chris Wilson chris at chris-wilson.co.uk
Tue Aug 27 14:32:08 UTC 2019


The point of debug_object_activate is to mark we first, only the first,
acquisition. The object then remains active until the last release.
However, we marked up all successful first acquires even though we
allowed concurrent parties to try and acquire the i915_active
simultaneously (serialised by the i915_active.mutex).

Testcase: igt/gem_mmap_gtt/fault-concurrent
Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
Cc: Matthew Auld <matthew.auld at intel.com>
---
 drivers/gpu/drm/i915/i915_active.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_active.c b/drivers/gpu/drm/i915/i915_active.c
index 48e16ad93bbd..d9d89bde8256 100644
--- a/drivers/gpu/drm/i915/i915_active.c
+++ b/drivers/gpu/drm/i915/i915_active.c
@@ -92,11 +92,14 @@ static void debug_active_init(struct i915_active *ref)
 
 static void debug_active_activate(struct i915_active *ref)
 {
-	debug_object_activate(ref, &active_debug_desc);
+	lockdep_assert_held(&ref->mutex);
+	if (!atomic_read(&ref->count))
+		debug_object_activate(ref, &active_debug_desc);
 }
 
 static void debug_active_deactivate(struct i915_active *ref)
 {
+	lockdep_assert_held(&ref->mutex);
 	debug_object_deactivate(ref, &active_debug_desc);
 }
 
-- 
2.23.0



More information about the Intel-gfx-trybot mailing list