FROMLIST: lockdep: Remove console_verbose when disable lock debugging

debug_locks_off can be called in scenarios where the kernel doesn't
immediately panic. For instance, debug_locks_off is called with a
mismatched preempt_count or when registering an improper lockdep map
and fails the sanity check for lock-class key [1]. Both of these issues
were discovered in vendor kernel code and were fixed.

When console_verbose is enabled, we have found that kernel tends to be
unstable because it is spending much of its time printing to the serial
log, so the system may miss watchdog pats. We explicitly set our system
to reduce the loglevel in order to prevent such scenarios, however
lockdep can circumvent the commandline setting. Thus, when we ran into
the kernel bugs, we first ended up trying to debug why the kernel wasn't
able to respond to watchdog pets and why it was spending all of its time
flushing the console, which did not quickly lead us to the "real"
lock dependency issue.

Remove the console_verbose when turning off lock debugging. Other debug
facilities, such as KASAN, KFENCE, SPINLOCK_DEBUG, and DEBUG_OBJECTS
don't set console_verbose when issues are detected. Current other uses
for console_verbose are in situations where kernel is in a panic path.

[1]: kernel/locking/lockdep.c:lockdep_init_map_waits:4617

Signed-off-by: Elliot Berman <eberman@codeaurora.org>

Link: https://lore.kernel.org/lkml/20210623045559.15750-1-eberman@codeaurora.org/
Bug: 191903062
Change-Id: If33587c49d316155a1745c9e0ef1a9ce23410a2b
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
This commit is contained in:
Elliot Berman 2021-06-17 12:51:25 -07:00 committed by Greg Kroah-Hartman
parent 4458494476
commit 52ccdf90b9

View File

@ -38,12 +38,8 @@ EXPORT_SYMBOL_GPL(debug_locks_silent);
*/
noinstr int debug_locks_off(void)
{
if (debug_locks && __debug_locks_off()) {
if (!debug_locks_silent) {
console_verbose();
return 1;
}
}
if (debug_locks && __debug_locks_off() && !debug_locks_silent)
return 1;
return 0;
}
EXPORT_SYMBOL_GPL(debug_locks_off);