ANDROID: ftrace: vendor hook for ftrace dump on oops
Add following vendor hooks in ftrace oops path to allow
vendor modules to get ftrace buffer data.
1) android_vh_ftrace_format_check
Bug: 177387994
Change-Id: I898026bfc3e5c5c5ab1eaa0e86a019a6a720408e
Signed-off-by: Prateek Sood <prsood@codeaurora.org>
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
(cherry picked from commit fbbc48ef18)
This commit is contained in:
committed by
Treehugger Robot
parent
f0ff9d0ac5
commit
3ae30651fd
@@ -36,6 +36,7 @@
|
||||
#include <trace/hooks/timer.h>
|
||||
#include <trace/hooks/fpsimd.h>
|
||||
#include <trace/hooks/dtask.h>
|
||||
#include <trace/hooks/ftrace_dump.h>
|
||||
|
||||
/*
|
||||
* Export tracepoints that act as a bare tracehook (ie: have no trace event
|
||||
@@ -97,3 +98,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery_set);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_timer_calc_index);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sched_show_task);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_ftrace_format_check);
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#undef TRACE_SYSTEM
|
||||
#define TRACE_SYSTEM ftrace_dump
|
||||
|
||||
#define TRACE_INCLUDE_PATH trace/hooks
|
||||
|
||||
#if !defined(_TRACE_HOOK_FTRACE_DUMP_H) || defined(TRACE_HEADER_MULTI_READ)
|
||||
#define _TRACE_HOOK_FTRACE_DUMP_H
|
||||
|
||||
#include <trace/hooks/vendor_hooks.h>
|
||||
|
||||
DECLARE_HOOK(android_vh_ftrace_format_check,
|
||||
TP_PROTO(bool *ftrace_check),
|
||||
TP_ARGS(ftrace_check));
|
||||
|
||||
#endif /* _TRACE_HOOK_FTRACE_DUMP_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
+12
-2
@@ -48,6 +48,7 @@
|
||||
#include <linux/fsnotify.h>
|
||||
#include <linux/irq_work.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <trace/hooks/ftrace_dump.h>
|
||||
|
||||
#include <asm/setup.h> /* COMMAND_LINE_SIZE */
|
||||
|
||||
@@ -10246,6 +10247,7 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m
|
||||
unsigned int old_userobj;
|
||||
unsigned long flags;
|
||||
int cnt = 0, cpu;
|
||||
bool ftrace_check = true;
|
||||
|
||||
/*
|
||||
* Always turn off tracing when we dump.
|
||||
@@ -10287,6 +10289,14 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m
|
||||
printk("# MAY BE MISSING FUNCTION EVENTS\n");
|
||||
}
|
||||
|
||||
/*
|
||||
* Ftrace timestmap support two types:
|
||||
* - ftrace_check = 1, latency format, start with 0 from a specific time.
|
||||
* - ftrace_check = 0, absolute time format, consistent with kernel time.
|
||||
* With this vendor hook, we can choose the format from different requirement.
|
||||
*/
|
||||
trace_android_vh_ftrace_format_check(&ftrace_check);
|
||||
|
||||
/*
|
||||
* We need to stop all tracing on all CPUS to read
|
||||
* the next buffer. This is a bit expensive, but is
|
||||
@@ -10295,14 +10305,14 @@ static void ftrace_dump_one(struct trace_array *tr, enum ftrace_dump_mode dump_m
|
||||
*/
|
||||
|
||||
while (!trace_empty(&iter)) {
|
||||
|
||||
if (!cnt)
|
||||
printk(KERN_TRACE "---------------------------------\n");
|
||||
|
||||
cnt++;
|
||||
|
||||
trace_iterator_reset(&iter);
|
||||
iter.iter_flags |= TRACE_FILE_LAT_FMT;
|
||||
if (ftrace_check)
|
||||
iter.iter_flags |= TRACE_FILE_LAT_FMT;
|
||||
|
||||
if (trace_find_next_entry_inc(&iter) != NULL) {
|
||||
int ret;
|
||||
|
||||
Reference in New Issue
Block a user