linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Petr Mladek <pmladek@suse.com>
Cc: Sreenath Vijayan <sreenath.vijayan@sony.com>,
	john.ogness@linutronix.de, corbet@lwn.net, jirislaby@kernel.org,
	rdunlap@infradead.org, rostedt@goodmis.org,
	senozhatsky@chromium.org, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org,
	taichi.shimoyashiki@sony.com, daniel.palmer@sony.com,
	anandakumar.balasubramaniam@sony.com
Subject: Re: [PATCH v4 2/2] tty/sysrq: Dump printk ring buffer messages via sysrq
Date: Thu, 8 Feb 2024 10:18:35 +0000	[thread overview]
Message-ID: <2024020845-antiquely-faculty-407d@gregkh> (raw)
In-Reply-To: <ZcOdLrOPiPJmCec5@alley>

On Wed, Feb 07, 2024 at 04:09:34PM +0100, Petr Mladek wrote:
> 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.

I just remembered all the rt-changes coming down the pipe for
consoles/printk, is this going to mess with that?

And in thinking about it, the workqueue is a worry, sysrq is only
usually hit if you have a lockup, and this isn't going to work well
here, if at all, in that situation.

So when this option fails when people need it the most, perhaps it's not
worth adding?  When else would people want to use it?

thanks,

greg k-h

  reply	other threads:[~2024-02-08 10:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 10:16 [PATCH v4 0/2] Add support to dump printk buffer to console via sysrq Sreenath Vijayan
2024-02-01 10:23 ` [PATCH v4 1/2] printk: Add function to dump printk buffer directly to consoles Sreenath Vijayan
2024-02-01 11:28   ` John Ogness
2024-02-07 14:43   ` Petr Mladek
2024-02-14 10:33     ` Sreenath Vijayan
2024-02-01 10:29 ` [PATCH v4 2/2] tty/sysrq: Dump printk ring buffer messages via sysrq Sreenath Vijayan
2024-02-01 11:29   ` John Ogness
2024-02-07 15:09   ` Petr Mladek
2024-02-08 10:18     ` Greg KH [this message]
2024-02-08 13:39       ` John Ogness
2024-02-14 10:40     ` Sreenath Vijayan
2024-02-14 11:12     ` Sreenath Vijayan
2024-02-26  8:01       ` Sreenath Vijayan
2024-02-26  9:28       ` John Ogness
2024-02-07 14:12 ` [PATCH v4 0/2] Add support to dump printk buffer to console " Petr Mladek
2024-02-14 10:30   ` Sreenath Vijayan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2024020845-antiquely-faculty-407d@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=anandakumar.balasubramaniam@sony.com \
    --cc=corbet@lwn.net \
    --cc=daniel.palmer@sony.com \
    --cc=jirislaby@kernel.org \
    --cc=john.ogness@linutronix.de \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rdunlap@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=sreenath.vijayan@sony.com \
    --cc=taichi.shimoyashiki@sony.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).