When testing with lockdep disabled, if it becomes disabled due to some
error or other that makes subsequenting testing incomplete, it taints
the test result. Make this obvious to the test infrastructure by adding
TAINT_CRAP.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
Cc: Tomi Sarvela <tomi.p.sarv...@intel.com>
Cc: Daniel Vetter <daniel.vet...@ffwll.ch>
---
Thoughts? Preferred over parsing lock_stats in addition to kernel/taint?
Downside is that since locks are disabled before oops printing and the
like, we will see TAINT_CRAP on first oops/panic (I think) rather than
subsequent oopses.
-Chris
---
 kernel/panic.c    | 4 +++-
 lib/debug_locks.c | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 2cfef408fec9..f4ba13e94be6 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -392,8 +392,10 @@ unsigned long get_taint(void)
  */
 void add_taint(unsigned flag, enum lockdep_ok lockdep_ok)
 {
-       if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off())
+       if (lockdep_ok == LOCKDEP_NOW_UNRELIABLE && __debug_locks_off()) {
                pr_warn("Disabling lock debugging due to kernel taint\n");
+               set_bit(TAINT_CRAP, &tainted_mask);
+       }
 
        set_bit(flag, &tainted_mask);
 }
diff --git a/lib/debug_locks.c b/lib/debug_locks.c
index 96c4c633d95e..8abe7bb50842 100644
--- a/lib/debug_locks.c
+++ b/lib/debug_locks.c
@@ -38,6 +38,7 @@ EXPORT_SYMBOL_GPL(debug_locks_silent);
 int debug_locks_off(void)
 {
        if (__debug_locks_off()) {
+               add_taint(TAINT_CRAP, LOCKDEP_STILL_OK);
                if (!debug_locks_silent) {
                        console_verbose();
                        return 1;
-- 
2.15.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to