Is there any tips or method to avoid kernel log drop or log buffer overrun ?
I have increased the log buffer size to maximum with below code change. I'm running in high end device only. But, still when when i want to get the complete log from my driver(which writes heavy logs), I see the printk logs are dropped sometimes. I use printk with KERN_INFO, gets enabled through dynamic debug(dprintk).
Change i do:
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -55,7 +55,7 @@ void asmlinkage __attribute__((weak)) early_printk(const char *fmt, ...)
{
}
-#define __LOG_BUF_LEN (1 << CONFIG_LOG_BUF_SHIFT)
+#define __LOG_BUF_LEN (1 << 17)
Command i use to write into a file:
cat "/proc/kmsg">/sdcard/klog.txt
Only While debugging, I'm okay if the performance is degraded in my driver but, i don't want drop any logs. I understand we can't make work queues/threads to wait until printing completes. But, still is there any way to get guaranteed that, logs are not dropped.
# tail -f /var/log/messages > /tmp/tmplog.txt &
is one simple way to get around this. – Arthurarthurian