ANDROID: softlockup: add vendor hook for a softlockup task

Add hook to gather data of softlockup and summarize it with
other information.

It helps the bootloader produce the summary information when
kernel panic or watchdog reset occurs. It can be obtained through
Ramdump, etc., and this information can be used to quickly classify
and respond to problems.

Bug: 326888644
Bug: 386310634

Change-Id: I5263bbd573c3fa4b4c981ac26c943721ce09506d
Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
(cherry picked from commit c6e2bf2162446f18b1557f3adcd3ee915ba708f4)
This commit is contained in:
Sangmoon Kim
2021-01-19 21:19:01 +09:00
committed by T.J. Mercier
parent bca065e876
commit ca2d053a94
3 changed files with 22 additions and 0 deletions
+2
View File
@@ -52,6 +52,7 @@
#include <trace/hooks/bug.h>
#include <trace/hooks/logbuf.h>
#include <trace/hooks/regmap.h>
#include <trace/hooks/softlockup.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -193,3 +194,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_shmem_get_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_slab_folio_alloced);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_kmalloc_large_alloced);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_ctl_dirty_rate);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_watchdog_timer_softlockup);
+17
View File
@@ -0,0 +1,17 @@
/* 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 <trace/hooks/vendor_hooks.h>
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 <trace/define_trace.h>
+3
View File
@@ -32,6 +32,8 @@
#include <asm/irq_regs.h>
#include <trace/hooks/softlockup.h>
static DEFINE_MUTEX(watchdog_mutex);
#if defined(CONFIG_HARDLOCKUP_DETECTOR) || defined(CONFIG_HARDLOCKUP_DETECTOR_SPARC64)
@@ -767,6 +769,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");