Re: [RFC PATCH] Allow for stack traces to be printed on serial console

From: Srivatsa S. Bhat
Date: Mon Oct 03 2011 - 05:30:20 EST

On 09/30/2011 10:19 AM, Pavel Ivanov wrote:
> When I tried to chase some mysterious lockup of my PC the only means to
> see some error reports for me was serial console. But it looks like only
> printk with KERN_ERR is sent to serial console. So when hung task
> detector tried to show me stack traces for hung tasks I didn't see them
> on serial console and I didn't see them after reboot as they couldn't be
> saved to dmesg. Thus the following patch allowed me to actually see
> those stack traces.

Which kernel messages gets displayed on your serial console is controlled by
your system configuration which can be altered by modifying /etc/rsyslog.conf
or /etc/sysconfig/syslog.conf
There you can specify that you want to print every kernel message by specifying
kern.* for example.

There are also some kernel command line options you can use to specify which
level of kernel messages you want to get displayed.

Since you clearly have a system configuration problem here, you don't need to alter the
kernel source to print with KERN_ERR everywhere. Doing that would also defeat the very
purpose of having that nice distinction between informational messages, error messages
and so on, isn't it?

> I believe kernel prints stack traces only in some serious cases and
> expects that they would be actually seen, so KERN_ERR looks justified
> for me in all changed places. I understand that patch is incomplete and
> would need some other places to be changed for consistency (at least
> other arch code). But first I want to hear comments on whether this
> approach is good enough to be included in mainline or it should be left
> for me as a hack.
Srivatsa S. Bhat <srivatsa.bhat@xxxxxxxxxxxxxxxxxx>
Linux Technology Center,
IBM India Systems and Technology Lab
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at