ANDROID: logbuf: vendor hook for logbuf dump on oops

Initial kernel bootup logs get overwritten after running
for a long time, and there can be debugging scenario where
we need initial ~100s bootup logs for debugging.
'android_vh_initial_logbuf' vendor hook is helping in
achieving this purpose.

Bug: 185182649
Change-Id: I706824aeb566c09ecaf4b5900973d6cee8a2f35b
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
This commit is contained in:
Mukesh Ojha
2021-04-13 09:32:41 +05:30
committed by Todd Kjos
parent fc380a2a73
commit 34fde61f72
3 changed files with 31 additions and 0 deletions

View File

@@ -50,6 +50,7 @@
#include <trace/hooks/typec.h>
#include <trace/hooks/gpiolib.h>
#include <trace/hooks/signal.h>
#include <trace/hooks/logbuf.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -238,3 +239,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_preset);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_post_init_entity_util_avg);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_get_timer);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_typec_tcpm_adj_current_limit);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_logbuf);

View File

@@ -0,0 +1,26 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM logbuf
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_LOGBUF_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_LOGBUF_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
struct printk_ringbuffer;
struct printk_record;
DECLARE_HOOK(android_vh_logbuf,
TP_PROTO(struct printk_ringbuffer *rb, struct printk_record *r),
TP_ARGS(rb, r))
#else
#define trace_android_vh_logbuf(rb, r)
#endif
#endif /* _TRACE_HOOK_LOGBUF_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -56,6 +56,7 @@
#include <trace/events/printk.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/printk.h>
#include <trace/hooks/logbuf.h>
#include "printk_ringbuffer.h"
#include "console_cmdline.h"
@@ -538,6 +539,8 @@ static int log_store(u32 caller_id, int facility, int level,
else
prb_final_commit(&e);
trace_android_vh_logbuf(prb, &r);
return (text_len + trunc_msg_len);
}