diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index a46a4a928092..9d9c3ec5bb5a 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -21,6 +21,7 @@ #include #include #include +#include /* * 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); diff --git a/include/trace/hooks/printk.h b/include/trace/hooks/printk.h new file mode 100644 index 000000000000..83f8ad5e710d --- /dev/null +++ b/include/trace/hooks/printk.h @@ -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 +#include + +#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 diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c index dc0b25e1f395..fd80157d7a14 100644 --- a/kernel/printk/printk.c +++ b/kernel/printk/printk.c @@ -54,6 +54,8 @@ #include #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include #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())