From aa9b60bb87a69ba2e0472fbfb04a8c056690936f Mon Sep 17 00:00:00 2001 From: Laura Abbott Date: Mon, 23 Jan 2012 13:06:20 -0800 Subject: [PATCH] printk: Log printk events Log printk events to the uncached buffer. If a reset occurs and printk data is still present in the cache, information will be lost. This doesn't store the actual printk, but it at least gives information on who the last caller was. Change-Id: If1bd414a44b19b45c157d23a7ddde8f16b30e780 Signed-off-by: Laura Abbott Signed-off-by: Trevor Bourget --- arch/arm/mach-msm/include/mach/msm_rtb.h | 1 + arch/arm/mach-msm/msm_rtb.c | 1 + kernel/printk.c | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-msm/include/mach/msm_rtb.h b/arch/arm/mach-msm/include/mach/msm_rtb.h index a24e8925942..ac45cbd7e07 100644 --- a/arch/arm/mach-msm/include/mach/msm_rtb.h +++ b/arch/arm/mach-msm/include/mach/msm_rtb.h @@ -17,6 +17,7 @@ enum logk_event_type { LOGK_NONE = 0, LOGK_READL, LOGK_WRITEL, + LOGK_LOGBUF, LOGK_OTHER, }; diff --git a/arch/arm/mach-msm/msm_rtb.c b/arch/arm/mach-msm/msm_rtb.c index d765f6a6282..f93a79b6246 100644 --- a/arch/arm/mach-msm/msm_rtb.c +++ b/arch/arm/mach-msm/msm_rtb.c @@ -65,6 +65,7 @@ static atomic_t msm_rtb_idx; struct msm_rtb_state msm_rtb = { .size = SZ_1M, + .filter = 1 << LOGK_LOGBUF, }; module_param_named(filter, msm_rtb.filter, uint, 0644); diff --git a/kernel/printk.c b/kernel/printk.c index dbaa948f530..3c313957799 100644 --- a/kernel/printk.c +++ b/kernel/printk.c @@ -41,7 +41,7 @@ #include #include #include - +#include #include /* @@ -784,6 +784,11 @@ asmlinkage int printk(const char *fmt, ...) { va_list args; int r; +#ifdef CONFIG_MSM_RTB + void *caller = __builtin_return_address(0); + + uncached_logk_pc(LOGK_LOGBUF, caller, (void *)log_end); +#endif #ifdef CONFIG_KGDB_KDB if (unlikely(kdb_trap_printk)) {