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 <[email protected]>
Cc: Matthew Auld <[email protected]>
---
 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

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to