Merge "lib: spinlock: Cause a watchdog bite on spin_dump"

This commit is contained in:
qctecmdr 2020-05-02 00:07:40 -07:00 • committed by Gerrit - the friendly Code Review server
commit 80aa14bd32
2 changed files with 31 additions and 0 deletions

View file

@ -12,6 +12,8 @@
#include <linux/debug_locks.h>
#include <linux/delay.h>
#include <linux/export.h>
#include <linux/bug.h>
#include <soc/qcom/watchdog.h>
void __raw_spin_lock_init(raw_spinlock_t *lock, const char *name,
struct lock_class_key *key)
@ -64,6 +66,12 @@ static void spin_dump(raw_spinlock_t *lock, const char *msg)
owner ? owner->comm : "<none>",
owner ? task_pid_nr(owner) : -1,
READ_ONCE(lock->owner_cpu));
#ifdef CONFIG_DEBUG_SPINLOCK_BITE_ON_BUG
msm_trigger_wdog_bite();
#elif defined(CONFIG_DEBUG_SPINLOCK_PANIC_ON_BUG)
BUG();
#endif
dump_stack();
}

View file

@ -1085,6 +1085,29 @@ config LOCK_DEBUGGING_SUPPORT
depends on TRACE_IRQFLAGS_SUPPORT && STACKTRACE_SUPPORT && LOCKDEP_SUPPORT
default y
choice
prompt "Perform Action on spinlock bug"
depends on DEBUG_SPINLOCK
default DEBUG_SPINLOCK_BITE_ON_BUG
config DEBUG_SPINLOCK_BITE_ON_BUG
bool "Cause a Watchdog Bite on Spinlock bug"
depends on QCOM_WATCHDOG_V2
help
On a spinlock bug, cause a watchdog bite so that we can get
the precise state of the system captured at the time of spin
dump. This is mutually exclusive with the below
DEBUG_SPINLOCK_PANIC_ON_BUG config.
config DEBUG_SPINLOCK_PANIC_ON_BUG
bool "Cause a Kernel Panic on Spinlock bug"
help
On a spinlock bug, cause a kernel panic so that we can get the complete
information about the system at the time of spin dump in the dmesg.
This is mutually exclusive with the above DEBUG_SPINLOCK_BITE_ON_BUG.
endchoice
config PROVE_LOCKING
bool "Lock debugging: prove locking correctness"
depends on DEBUG_KERNEL && LOCK_DEBUGGING_SUPPORT