lkml.org 
[lkml]   [2024]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v4 2/2] tty/sysrq: Dump printk ring buffer messages via sysrq
On Wed, Feb 14, 2024 at 04:42:36PM +0530, Sreenath Vijayan wrote:
> On Wed, Feb 07, 2024 at 04:09:34PM +0100, Petr Mladek wrote:
> > 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
>
> Yes, this seems to work well from interrupt context when the
> console lock owner is not stuck. We can also manipulate
> the console_loglevel. Something like this:
>
> //in printk.c
> void console_replay_all(void)
> {
> if (console_trylock()) {
> __console_rewind_all();
> console_unlock();
> }
> }
>
> //in sysrq.c
> static void sysrq_handle_dmesg_dump(u8 key)
> {
> int orig_log_level = console_loglevel;
> console_loglevel = CONSOLE_LOGLEVEL_DEFAULT;
> console_replay_all();
> console_loglevel = orig_log_level;
> }
>
>
> The downside I see is that the user may have to hit the
> key multiple times or give up trying if the console lock
> owner is busy at the time of key press. This information
> should probably be updated in the documentation.
>
> Please let me know your opinion.
>
> Regards,
> Sreenath

Hi,

Kindly let me know your opinion on the suggested changes.

Regards,
Sreenath

\
 
 \ /
  Last update: 2024-05-27 15:21    [W:0.141 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site