[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Zk7ZuhHGW2R6N1E4@sreenath.vijayan@sony.com>
Date: Thu, 23 May 2024 11:22:58 +0530
From: Sreenath Vijayan <sreenath.vijayan@...y.com>
To: Petr Mladek <pmladek@...e.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 v6 1/2] printk: Add function to replay kernel log on
consoles
On Wed, May 22, 2024 at 05:18:13PM +0200, Petr Mladek wrote:
>
> On Wed 2024-03-13 15:50:52, Sreenath Vijayan wrote:
> > Add a generic function console_replay_all() for replaying
> > the kernel log on consoles, in any context. It would allow
> > viewing the logs on an unresponsive terminal via sysrq.
> >
> > Reuse the existing code from console_flush_on_panic() for
> > resetting the sequence numbers, by introducing a new helper
> > function __console_rewind_all(). It is safe to be called
> > under console_lock().
> >
> > Try to acquire lock on the console subsystem without waiting.
> > If successful, reset the sequence number to oldest available
> > record on all consoles and call console_unlock() which will
> > automatically flush the messages to the consoles.
> >
> > --- a/kernel/printk/printk.c
> > +++ b/kernel/printk/printk.c
> > @@ -4259,6 +4271,23 @@ void kmsg_dump_rewind(struct kmsg_dump_iter *iter)
> > }
> > EXPORT_SYMBOL_GPL(kmsg_dump_rewind);
> >
> > +/**
> > + * console_replay_all - replay kernel log on consoles
>
> It should rather be called "console_try_replay_all()" to make it clear
> that it is just the best effort.
>
Ok, noted.
> > + *
> > + * Try to obtain lock on console subsystem and replay all
> > + * available records in printk buffer on the consoles.
> > + * Does nothing if lock is not obtained.
> > + *
> > + * Context: Any context.
>
> This should be:
>
> * Context: Any, except for NMI
>
> Basically only lockless code is safe in NMI which is not the case here.
>
Understood.
> > + */
> > +void console_replay_all(void)
> > +{
> > + if (console_trylock()) {
> > + __console_rewind_all();
> > + /* Consoles are flushed as part of console_unlock(). */
> > + console_unlock();
> > + }
> > +}
> > #endif
>
> Otherwise, it looks good. With the two changes:
>
> Reviewed-by: Petr Mladek <pmladek@...e.com>
>
> I am sorry for the late review. I have been snowed under tasks.
> Also I had healthy problems.
>
> I have seen a mail that Greg has queued the patch in tty-next.
> I am not sure if it still can be fixed. It will be perfectly fine
> to change this by a followup patch.
>
> Best Regards,
> Petr
Thank you for the review comments. As the patch has been merged to
mainline, I will soon send a followup patch with "Fixes:" tag.
Regards,
Sreenath
Powered by blists - more mailing lists