ANDROID: bug: add vendor hook for bug trap

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

Bug: 222638752

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: I1f347c20629786f9bf0b9c50c7f96b50b4360504
This commit is contained in:
Sangmoon Kim
2021-01-19 20:55:28 +09:00
parent f154a239c3
commit ba7e9d1a77
3 changed files with 23 additions and 0 deletions

View File

@@ -45,6 +45,7 @@
#include <trace/hooks/logbuf.h> #include <trace/hooks/logbuf.h>
#include <trace/hooks/remoteproc.h> #include <trace/hooks/remoteproc.h>
#include <trace/hooks/hung_task.h> #include <trace/hooks/hung_task.h>
#include <trace/hooks/bug.h>
/* /*
* Export tracepoints that act as a bare tracehook (ie: have no trace event * Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -225,3 +226,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_util_est_update);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_setscheduler_uclamp); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_setscheduler_uclamp);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_wake_up_sync);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_set_wake_flags);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_report_bug);

17
include/trace/hooks/bug.h Normal file
View File

@@ -0,0 +1,17 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM bug
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_BUG_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_BUG_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
DECLARE_RESTRICTED_HOOK(android_rvh_report_bug,
TP_PROTO(const char *file, unsigned int line, unsigned long bugaddr),
TP_ARGS(file, line, bugaddr), 1);
#endif /* _TRACE_HOOK_BUG_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -49,6 +49,8 @@
#include <linux/rculist.h> #include <linux/rculist.h>
#include <linux/ftrace.h> #include <linux/ftrace.h>
#include <trace/hooks/bug.h>
extern struct bug_entry __start___bug_table[], __stop___bug_table[]; extern struct bug_entry __start___bug_table[], __stop___bug_table[];
static inline unsigned long bug_addr(const struct bug_entry *bug) static inline unsigned long bug_addr(const struct bug_entry *bug)
@@ -207,6 +209,8 @@ enum bug_trap_type report_bug(unsigned long bugaddr, struct pt_regs *regs)
pr_crit("Kernel BUG at %pB [verbose debug info unavailable]\n", pr_crit("Kernel BUG at %pB [verbose debug info unavailable]\n",
(void *)bugaddr); (void *)bugaddr);
trace_android_rvh_report_bug(file, line, bugaddr);
return BUG_TRAP_TYPE_BUG; return BUG_TRAP_TYPE_BUG;
} }