mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 03:15:31 +09:00
ANDROID: printk: add vendor hook to record more information about caller
With these hooks, printk can provide more information, such as the processor ID. Bug: 223302138 Signed-off-by: Ben Dai <ben.dai@unisoc.com> Change-Id: Iac60ffd49640d8badf5c5dd446c211d37bbbc6a6
This commit is contained in:
@@ -89,6 +89,9 @@ 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);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_caller_id);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_caller);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_printk_ext_header);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_jiffies_update);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_v3_set_affinity);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_set_affinity);
|
||||
|
||||
@@ -14,6 +14,16 @@ DECLARE_HOOK(android_vh_printk_hotplug,
|
||||
TP_PROTO(int *flag),
|
||||
TP_ARGS(flag));
|
||||
|
||||
DECLARE_HOOK(android_vh_printk_caller_id,
|
||||
TP_PROTO(u32 *caller_id),
|
||||
TP_ARGS(caller_id));
|
||||
DECLARE_HOOK(android_vh_printk_caller,
|
||||
TP_PROTO(char *caller, size_t size, u32 id, int *ret),
|
||||
TP_ARGS(caller, size, id, ret));
|
||||
DECLARE_HOOK(android_vh_printk_ext_header,
|
||||
TP_PROTO(char *caller, size_t size, u32 id, int *ret),
|
||||
TP_ARGS(caller, size, id, ret));
|
||||
|
||||
#endif /* _TRACE_HOOK_PRINTK_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
@@ -557,10 +557,14 @@ static ssize_t info_print_ext_header(char *buf, size_t size,
|
||||
u64 ts_usec = info->ts_nsec;
|
||||
char caller[20];
|
||||
#ifdef CONFIG_PRINTK_CALLER
|
||||
int vh_ret = 0;
|
||||
u32 id = info->caller_id;
|
||||
|
||||
snprintf(caller, sizeof(caller), ",caller=%c%u",
|
||||
id & 0x80000000 ? 'C' : 'T', id & ~0x80000000);
|
||||
trace_android_vh_printk_ext_header(caller, sizeof(caller), id, &vh_ret);
|
||||
|
||||
if (!vh_ret)
|
||||
snprintf(caller, sizeof(caller), ",caller=%c%u",
|
||||
id & 0x80000000 ? 'C' : 'T', id & ~0x80000000);
|
||||
#else
|
||||
caller[0] = '\0';
|
||||
#endif
|
||||
@@ -1269,9 +1273,12 @@ static size_t print_time(u64 ts, char *buf)
|
||||
static size_t print_caller(u32 id, char *buf)
|
||||
{
|
||||
char caller[12];
|
||||
int vh_ret = 0;
|
||||
|
||||
snprintf(caller, sizeof(caller), "%c%u",
|
||||
id & 0x80000000 ? 'C' : 'T', id & ~0x80000000);
|
||||
trace_android_vh_printk_caller(caller, sizeof(caller), id, &vh_ret);
|
||||
if (!vh_ret)
|
||||
snprintf(caller, sizeof(caller), "%c%u",
|
||||
id & 0x80000000 ? 'C' : 'T', id & ~0x80000000);
|
||||
return sprintf(buf, "[%6s]", caller);
|
||||
}
|
||||
#else
|
||||
@@ -2020,6 +2027,12 @@ static inline void printk_delay(void)
|
||||
|
||||
static inline u32 printk_caller_id(void)
|
||||
{
|
||||
u32 caller_id = 0;
|
||||
|
||||
trace_android_vh_printk_caller_id(&caller_id);
|
||||
if (caller_id)
|
||||
return caller_id;
|
||||
|
||||
return in_task() ? task_pid_nr(current) :
|
||||
0x80000000 + raw_smp_processor_id();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user