From 5cc613a916fdd4285ba5118a0d3063a32c31fbcb Mon Sep 17 00:00:00 2001 From: Sangmoon Kim Date: Tue, 19 Jan 2021 21:19:01 +0900 Subject: [PATCH] ANDROID: softlockup: add vendor hook for a softlockup task Add hook to gather data of softlockup and summarize it with other information. Bug: 222638752 Signed-off-by: Sangmoon Kim Change-Id: I5263bbd573c3fa4b4c981ac26c943721ce09506d --- drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/softlockup.h | 18 ++++++++++++++++++ kernel/watchdog.c | 3 +++ 3 files changed, 23 insertions(+) create mode 100644 include/trace/hooks/softlockup.h diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 340ba2eca40d..dfcaa583c07b 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -46,6 +46,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -227,3 +228,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_setscheduler_uclamp); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watchdog_timer_softlockup); diff --git a/include/trace/hooks/softlockup.h b/include/trace/hooks/softlockup.h new file mode 100644 index 000000000000..e329fe6ec198 --- /dev/null +++ b/include/trace/hooks/softlockup.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM softlockup +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_SOFTLOCKUP_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_SOFTLOCKUP_H +#include +#include + +struct pt_regs; +DECLARE_HOOK(android_vh_watchdog_timer_softlockup, + TP_PROTO(int duration, struct pt_regs *regs, bool is_panic), + TP_ARGS(duration, regs, is_panic)); + +#endif /* _TRACE_HOOK_SOFTLOCKUP_H */ +/* This part must be outside protection */ +#include diff --git a/kernel/watchdog.c b/kernel/watchdog.c index ad912511a0c0..7a6ec8b16d5d 100644 --- a/kernel/watchdog.c +++ b/kernel/watchdog.c @@ -27,6 +27,8 @@ #include #include +#include + static DEFINE_MUTEX(watchdog_mutex); #if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HAVE_NMI_WATCHDOG) @@ -439,6 +441,7 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer) clear_bit_unlock(0, &soft_lockup_nmi_warn); } + trace_android_vh_watchdog_timer_softlockup(duration, regs, !!softlockup_panic); add_taint(TAINT_SOFTLOCKUP, LOCKDEP_STILL_OK); if (softlockup_panic) panic("softlockup: hung tasks");