ANDROID: printk: add vendor hook for console flush

Add vendor hook for skipping console flush in cpu hotplug.

Bug: 165340180
Change-Id: I167e1595bbb50e57371bfabfde638624761d5f8a
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
This commit is contained in:
Prasad Sodagudi
2020-10-22 04:26:09 -07:00
committed by Todd Kjos
parent 074a2b36c1
commit 7aaa29b82b
3 changed files with 37 additions and 0 deletions

View File

@@ -21,6 +21,7 @@
#include <trace/hooks/wqlockup.h>
#include <trace/hooks/debug.h>
#include <trace/hooks/sysrqcrash.h>
#include <trace/hooks/printk.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -64,3 +65,4 @@ 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);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_dump_throttled_rt_tasks);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_hotplug);

View File

@@ -0,0 +1,27 @@
/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM printk
#define TRACE_INCLUDE_PATH trace/hooks
#if !defined(_TRACE_HOOK_PRINTK_H) || defined(TRACE_HEADER_MULTI_READ)
#define _TRACE_HOOK_PRINTK_H
#include <linux/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
DECLARE_HOOK(android_vh_printk_hotplug,
TP_PROTO(int *flag),
TP_ARGS(flag));
#else
#define trace_android_vh_printk_hotplug(flag)
#endif
#endif /* _TRACE_HOOK_PRINTK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -54,6 +54,8 @@
#include <trace/events/initcall.h>
#define CREATE_TRACE_POINTS
#include <trace/events/printk.h>
#undef CREATE_TRACE_POINTS
#include <trace/hooks/printk.h>
#include "printk_ringbuffer.h"
#include "console_cmdline.h"
@@ -2293,6 +2295,12 @@ void resume_console(void)
*/
static int console_cpu_notify(unsigned int cpu)
{
int flag = 0;
trace_android_vh_printk_hotplug(&flag);
if (flag)
return 0;
if (!cpuhp_tasks_frozen) {
/* If trylock fails, someone else is doing the printing */
if (console_trylock())