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: 199236943
Change-Id: I706824aeb566c09ecaf4b5900973d6cee8a2f35b
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
(cherry picked from commit 34fde61f72)
Signed-off-by: Yogesh Lal <ylal@codeaurora.org>
This commit is contained in:
Mukesh Ojha
2021-04-13 09:32:41 +05:30
committed by Suren Baghdasaryan
parent 873cb4b915
commit 976f1840da
3 changed files with 30 additions and 0 deletions

View File

@@ -43,6 +43,7 @@
#include <trace/hooks/module.h>
#include <trace/hooks/selinux.h>
#include <trace/hooks/syscall_check.h>
#include <trace/hooks/logbuf.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -199,3 +200,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_check_bpf_syscall);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_set_cpus_allowed_ptr_locked);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_rto_next_cpu);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_em_dev_register_pd);
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"
@@ -2202,6 +2203,7 @@ int vprintk_store(int facility, int level,
else
prb_final_commit(&e);
trace_android_vh_logbuf(prb, &r);
ret = text_len + trunc_msg_len;
out:
printk_exit_irqrestore(recursion_ptr, irqflags);