Limitation of printing to kernel logs
I’m working on linux device drivers (kernel version 2.6.32-37). I debug my code mostly by printing to the kernel log (using printk). Everything went smoothly until my computer suddenly stopped responding. I checked it over and over again and my code seems to be correct.
My question is:
Is it possible that printing too much information to the kernel log will cause the computer to stop responding?
Thank you very much!
I suspect the problem is caused by
printk, of course using
printk itself slows down the whole code, but doesn’t crash your system.
This is a quote from the Ubuntu Kernel Debugging Trick :
The internal kernel console message buffer can sometimes be too small to capture all printk messages, especially if your debugging code generates a large number of printk messages. If the buffer is full, it wraps around and may lose debug messages with value.
As you’ve read, when too much data is printed, you just need to start overwriting some of the old data you’d like to see in the log files; This is a problem because some debug messages disappear without being annoying enough to crash the entire system.
I suggest you double-check your code again, try to keep track of when/where it crashed, and if you can’t fix the problem, post a question here or on some kernel hack mailing list.
P.S also has to mention that you need to be careful where you place
printk statements, as some areas of code may not tolerate the resulting delay, which can cause further problems resulting in stucks/crashes.