ANDROID: printk: add vendor hook to logging during hibernation

If hibernation fail, user cannot check log during hibernation. During
hibernation, we cannot get any log from copying hibernation image to shutdown
the system, for example, write image to storage. A vendor hook copies every log
with all loglevel to reserved memory address. We cannot get all loglevels with
pstore, so we add vendor hook for copying every log. When the system is
rebooted, user can check log from reserved memory address where vendor hook
stored in.

Bug: 342523877
Change-Id: I31f61378f555ea65ccecfa5b7a96a3ed3e4061a6
Signed-off-by: Dongbum Kim <dongbum.kim@lge.com>
This commit is contained in:
Dongbum Kim
2025-02-20 16:27:03 +09:00
committed by Treehugger Robot
parent 4da91a8e56
commit 0ad7fae66c
3 changed files with 6 additions and 0 deletions

View File

@@ -473,3 +473,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sdhci_get_cd);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mmc_gpio_cd_irqt);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_trigger_vendor_lmk_kill);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_filemap_map_pages_range);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_vprintk_store);

View File

@@ -13,6 +13,10 @@ DECLARE_HOOK(android_vh_printk_hotplug,
TP_PROTO(int *flag),
TP_ARGS(flag));
DECLARE_HOOK(android_vh_vprintk_store,
TP_PROTO(u64 time, char *m, size_t len),
TP_ARGS(time, m, len));
#endif /* _TRACE_HOOK_PRINTK_H */
/* This part must be outside protection */
#include <trace/define_trace.h>

View File

@@ -2248,6 +2248,7 @@ int vprintk_store(int facility, int level,
r.info->flags = flags & 0x1f;
r.info->ts_nsec = ts_nsec;
r.info->caller_id = caller_id;
trace_android_vh_vprintk_store(r.info->ts_nsec, r.text_buf, r.info->text_len);
if (dev_info)
memcpy(&r.info->dev_info, dev_info, sizeof(r.info->dev_info));