ANDROID: sysrq: add vendor hook for sysrq crash information

- Add the hook to provide additional information
   of sysrq crash.

Bug: 170234110

Signed-off-by: Sangmoon Kim <sangmoon.kim@samsung.com>
Change-Id: Ib8f14eaa639b2ef959e911d611515868ff9f193d
(cherry picked from commit 32b242337266a3b8e170b0ddc4bec478d5cf1f94)
This commit is contained in:
Sangmoon Kim
2020-10-08 10:42:06 +09:00
parent 99be12b566
commit 0d8928ed6e
3 changed files with 30 additions and 0 deletions

View File

@@ -20,6 +20,7 @@
#include <trace/hooks/gic.h>
#include <trace/hooks/wqlockup.h>
#include <trace/hooks/debug.h>
#include <trace/hooks/sysrqcrash.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -61,3 +62,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_group);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_resume);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_wq_lockup_pool);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ipi_stop);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sysrq_crash);

View File

@@ -54,6 +54,8 @@
#include <asm/ptrace.h>
#include <asm/irq_regs.h>
#include <trace/hooks/sysrqcrash.h>
/* Whether we react on sysrq keys or just ignore them */
static int __read_mostly sysrq_enabled = CONFIG_MAGIC_SYSRQ_DEFAULT_ENABLE;
static bool __read_mostly sysrq_always_enabled;
@@ -150,6 +152,8 @@ static void sysrq_handle_crash(int key)
/* release the RCU read lock before crashing */
rcu_read_unlock();
trace_android_vh_sysrq_crash(current);
panic("sysrq triggered crash\n");
}
static const struct sysrq_key_op sysrq_crash_op = {

View File

@@ -0,0 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM sysrqcrash
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_SYSRQCRASH_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_SYSRQCRASH_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
*/
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
DECLARE_HOOK(android_vh_sysrq_crash,
TP_PROTO(void *data),
TP_ARGS(data));
#else
#define trace_android_vh_sysrq_crash(data)
#endif
#endif /* _TRACE_HOOK_SYSRQCRASH_H */
/* This part must be outside protection */
#include <trace/define_trace.h>