[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZcOdLrOPiPJmCec5@alley>
Date: Wed, 7 Feb 2024 16:09:34 +0100
From: Petr Mladek <pmladek@...e.com>
To: Sreenath Vijayan <sreenath.vijayan@...y.com>
Cc: john.ogness@...utronix.de, corbet@....net, gregkh@...uxfoundation.org,
jirislaby@...nel.org, rdunlap@...radead.org, rostedt@...dmis.org,
senozhatsky@...omium.org, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org,
taichi.shimoyashiki@...y.com, daniel.palmer@...y.com,
anandakumar.balasubramaniam@...y.com
Subject: Re: [PATCH v4 2/2] tty/sysrq: Dump printk ring buffer messages via
sysrq
On Thu 2024-02-01 13:12:41, Sreenath Vijayan wrote:
> When terminal is unresponsive, one cannot use dmesg to view printk
> ring buffer messages. Also, syslog services may be disabled,
> to check the messages after a reboot, especially on embedded systems.
> In this scenario, dump the printk ring buffer messages via sysrq
> by pressing sysrq+D.
I would use sysrq-R and say that it replays the kernel log on
consoles.
The word "dump" is ambiguous. People might thing that it calls
dmesg dumpers.
Also the messages would be shown on the terminal only when
console_loglevel is set to show all messages. This is done
in __handle_sysrq(). But it is not done in the workqueue
context.
Finally, the commit message should explain why workqueues are used
and what are the limitations. Something like:
<add>
The log is replayed using workqueues. The reason is that it has to
be done a safe way (in compare with panic context).
This also means that the sysrq won't have the desired effect
when the system is in so bad state that workqueues do not
make any progress.
</add>
Another reason might be that we do not want to do it in
an interrupt context. But this reason is questionable.
Many other sysrq commands do a complicate work and
print many messages as well.
Another reason is that the function need to use console_lock()
which can't be called in IRQ context. Maybe, we should use
console_trylock() instead.
The function would replay the messages only when console_trylock()
succeeds. Users could repeat the sysrq when it fails.
Idea:
Using console_trylock() actually might be more reliable than
workqueues. console_trylock() might fail repeatably when:
+ the console_lock() owner is stuck. But workqueues would fail
in this case as well.
+ there is a flood of messages. In this case, replaying
the log would not help much.
Another advantage is that the consoles would be flushed
in sysrq context with the manipulated console_loglevel.
Best Regards,
Petr
Powered by blists - more mailing lists