ANDROID: arm64: add vendor hooks for unusal abort cases
Add hooks to gather data of unsual aborts and summarize it with other information. Bug: 177483057 Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com> Change-Id: I5f44b12770ae4976a6e3b098bd95a05dea347764
This commit is contained in:
@@ -46,6 +46,8 @@
|
|||||||
#include <asm/system_misc.h>
|
#include <asm/system_misc.h>
|
||||||
#include <asm/sysreg.h>
|
#include <asm/sysreg.h>
|
||||||
|
|
||||||
|
#include <trace/hooks/traps.h>
|
||||||
|
|
||||||
static const char *handler[]= {
|
static const char *handler[]= {
|
||||||
"Synchronous Abort",
|
"Synchronous Abort",
|
||||||
"IRQ",
|
"IRQ",
|
||||||
@@ -404,6 +406,7 @@ void do_undefinstr(struct pt_regs *regs)
|
|||||||
if (call_undef_hook(regs) == 0)
|
if (call_undef_hook(regs) == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
trace_android_rvh_do_undefinstr(regs, user_mode(regs));
|
||||||
BUG_ON(!user_mode(regs));
|
BUG_ON(!user_mode(regs));
|
||||||
force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
|
force_signal_inject(SIGILL, ILL_ILLOPC, regs->pc, 0);
|
||||||
}
|
}
|
||||||
@@ -765,6 +768,7 @@ asmlinkage void notrace bad_mode(struct pt_regs *regs, int reason, unsigned int
|
|||||||
handler[reason], smp_processor_id(), esr,
|
handler[reason], smp_processor_id(), esr,
|
||||||
esr_get_class_string(esr));
|
esr_get_class_string(esr));
|
||||||
|
|
||||||
|
trace_android_rvh_bad_mode(regs, esr, reason);
|
||||||
__show_regs(regs);
|
__show_regs(regs);
|
||||||
local_daif_mask();
|
local_daif_mask();
|
||||||
panic("bad mode");
|
panic("bad mode");
|
||||||
@@ -830,6 +834,8 @@ void __noreturn arm64_serror_panic(struct pt_regs *regs, u32 esr)
|
|||||||
|
|
||||||
pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n",
|
pr_crit("SError Interrupt on CPU%d, code 0x%08x -- %s\n",
|
||||||
smp_processor_id(), esr, esr_get_class_string(esr));
|
smp_processor_id(), esr, esr_get_class_string(esr));
|
||||||
|
|
||||||
|
trace_android_rvh_arm64_serror_panic(regs, esr);
|
||||||
if (regs)
|
if (regs)
|
||||||
__show_regs(regs);
|
__show_regs(regs);
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@
|
|||||||
#include <trace/hooks/ufshcd.h>
|
#include <trace/hooks/ufshcd.h>
|
||||||
#include <trace/hooks/cgroup.h>
|
#include <trace/hooks/cgroup.h>
|
||||||
#include <trace/hooks/sys.h>
|
#include <trace/hooks/sys.h>
|
||||||
|
#include <trace/hooks/traps.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
|
||||||
@@ -179,3 +180,6 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_syscall_prctl_finished);
|
|||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_mutex_list_add);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mutex_unlock_slowpath);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake_finish);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_undefinstr);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_bad_mode);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_arm64_serror_panic);
|
||||||
|
32
include/trace/hooks/traps.h
Normal file
32
include/trace/hooks/traps.h
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
/* SPDX-License-Identifier: GPL-2.0 */
|
||||||
|
#undef TRACE_SYSTEM
|
||||||
|
#define TRACE_SYSTEM traps
|
||||||
|
#define TRACE_INCLUDE_PATH trace/hooks
|
||||||
|
|
||||||
|
#if !defined(_TRACE_HOOK_TRAPS_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||||
|
#define _TRACE_HOOK_TRAPS_H
|
||||||
|
#include <linux/tracepoint.h>
|
||||||
|
#include <trace/hooks/vendor_hooks.h>
|
||||||
|
/*
|
||||||
|
* Following tracepoints are not exported in tracefs and provide a
|
||||||
|
* mechanism for vendor modules to hook and extend functionality
|
||||||
|
*/
|
||||||
|
struct pt_regs;
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_do_undefinstr,
|
||||||
|
TP_PROTO(struct pt_regs *regs, bool user),
|
||||||
|
TP_ARGS(regs, user),
|
||||||
|
TP_CONDITION(!user));
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_bad_mode,
|
||||||
|
TP_PROTO(struct pt_regs *regs, unsigned int esr, int reason),
|
||||||
|
TP_ARGS(regs, reason, esr), 1);
|
||||||
|
|
||||||
|
DECLARE_RESTRICTED_HOOK(android_rvh_arm64_serror_panic,
|
||||||
|
TP_PROTO(struct pt_regs *regs, unsigned int esr),
|
||||||
|
TP_ARGS(regs, esr), 1);
|
||||||
|
|
||||||
|
/* macro versions of hooks are no longer required */
|
||||||
|
|
||||||
|
#endif /* _TRACE_HOOK_TRAPS_H */
|
||||||
|
/* This part must be outside protection */
|
||||||
|
#include <trace/define_trace.h>
|
Reference in New Issue
Block a user