diff mbox

lockdep: Mark up lock disabling with TAINT_CRAP

Message ID 20171205153111.8504-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Chris Wilson Dec. 5, 2017, 3:31 p.m. UTC
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 <chris@chris-wilson.co.uk>
Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
Cc: Daniel Vetter <daniel.vetter@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 mbox

Patch

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;