From 56da24e7a9ba0f5bab4a0c90de964ce1541b1695 Mon Sep 17 00:00:00 2001 From: Changki Kim Date: Sun, 23 Aug 2020 14:36:48 +0900 Subject: [PATCH] ANDROID: vendor_hooks: Add new android vendor hooks for ipi stop When a kernel panic occurred, it is sometimes caused by a other cpu than the panic cpu. When a panic cpu sends smp stop IPI, it can help to solve the problem even more if aonther cpu stores registers and run cache flush. Bug: 165956922 Change-Id: I747f776456330d904015cfe4ae423e4b63f18f85 Signed-off-by: Changki Kim Signed-off-by: Will McVicker Signed-off-by: Jonglin Lee --- arch/arm64/kernel/smp.c | 3 +++ drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/debug.h | 25 +++++++++++++++++++++++++ 3 files changed, 30 insertions(+) create mode 100644 include/trace/hooks/debug.h diff --git a/arch/arm64/kernel/smp.c b/arch/arm64/kernel/smp.c index 82e75fc2c903..0e74a1552122 100644 --- a/arch/arm64/kernel/smp.c +++ b/arch/arm64/kernel/smp.c @@ -53,6 +53,8 @@ #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include DEFINE_PER_CPU_READ_MOSTLY(int, cpu_number); EXPORT_PER_CPU_SYMBOL(cpu_number); @@ -901,6 +903,7 @@ static void do_handle_IPI(int ipinr) break; case IPI_CPU_STOP: + trace_android_vh_ipi_stop(get_irq_regs()); local_cpu_stop(); break; diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index bf8d07920de5..85f867a76f1d 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -19,6 +19,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -59,3 +60,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mpam_set); 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); diff --git a/include/trace/hooks/debug.h b/include/trace/hooks/debug.h new file mode 100644 index 000000000000..12ce5cf5e9a8 --- /dev/null +++ b/include/trace/hooks/debug.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM debug + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_DEBUG_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_DEBUG_H + +#include +#include + +#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) +struct pt_regs; + +DECLARE_HOOK(android_vh_ipi_stop, + TP_PROTO(struct pt_regs *regs), + TP_ARGS(regs)) +#else +#define trace_android_vh_ipi_stop(regs) +#endif + +#endif /* _TRACE_HOOK_DEBUG_H */ +/* This part must be outside protection */ +#include