We're hitting a bug in CI where MAX_STACK_TRACE_ENTRIES is set too low.
My guess is the repeated loading/unloading is creating multiples of the
same entries. As a hack just reset lockdep. This might only be necessary
for CI + PREEMPT_RT.

Signed-off-by: Maarten Lankhorst <[email protected]>
---
Forgot to commit the EXPORT_SYMBOL_GPL change.

 drivers/gpu/drm/i915/i915_module.c | 6 ++++++
 kernel/locking/lockdep.c           | 1 +
 2 files changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_module.c 
b/drivers/gpu/drm/i915/i915_module.c
index 5d9c35b5a1820..4c135688d9660 100644
--- a/drivers/gpu/drm/i915/i915_module.c
+++ b/drivers/gpu/drm/i915/i915_module.c
@@ -117,6 +117,12 @@ static void __exit i915_exit(void)
                if (init_funcs[i].exit)
                        init_funcs[i].exit();
        }
+
+       /* Workaround for "MAX_STACK_TRACE_ENTRIES" too low, reset all locks 
after exit */
+#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
+       if (i915_selftest.live || i915_selftest.mock || i915_selftest.perf)
+               lockdep_reset();
+#endif
 }
 
 module_init(i915_init);
diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index b9edc0339273d..d4804d94a10e8 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -6188,6 +6188,7 @@ void lockdep_reset(void)
                INIT_HLIST_HEAD(chainhash_table + i);
        raw_local_irq_restore(flags);
 }
+EXPORT_SYMBOL_GPL(lockdep_reset);
 
 /* Remove a class from a lock chain. Must be called with the graph lock held. 
*/
 static void remove_class_from_lock_chain(struct pending_free *pf,
-- 
2.51.0

Reply via email to