[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZzYqpTwVnB61kXuM@pathway.suse.cz>
Date: Thu, 14 Nov 2024 17:51:49 +0100
From: Petr Mladek <pmladek@...e.com>
To: Chris Down <chris@...isdown.name>
Cc: linux-kernel@...r.kernel.org,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
John Ogness <john.ogness@...utronix.de>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Tony Lindgren <tony.lindgren@...ux.intel.com>, kernel-team@...com
Subject: Re: [PATCH v6 03/11] printk: console: Implement core per-console
loglevel infrastructure
On Fri 2024-11-08 17:10:31, Petr Mladek wrote:
> On Mon 2024-10-28 16:45:37, Chris Down wrote:
> > Consoles can have vastly different latencies and throughputs. For
> > example, writing a message to the serial console can take on the order
> > of tens of milliseconds to get the UART to successfully write a message.
> > While this might be fine for a single, one-off message, this can cause
> > significant application-level stalls in situations where the kernel
> > writes large amounts of information to the console.
> >
> > --- a/drivers/tty/sysrq.c
> > +++ b/drivers/tty/sysrq.c
> > @@ -101,11 +102,25 @@ __setup("sysrq_always_enabled", sysrq_always_enabled_setup);
> > static void sysrq_handle_loglevel(u8 key)
> > {
> > u8 loglevel = key - '0';
> > + int cookie;
> > + int warned = 0;
> > + struct console *con;
> >
> > console_loglevel = CONSOLE_LOGLEVEL_DEFAULT;
> > pr_info("Loglevel set to %u\n", loglevel);
> > console_loglevel = loglevel;
> > +
> > + cookie = console_srcu_read_lock();
> > + for_each_console_srcu(con) {
> > + if (!warned && per_console_loglevel_is_set(con)) {
> > + warned = 1;
> > + pr_warn("Overriding per-console loglevel from sysrq\n");
It just came to my mind. We could use pr_warn_once() and get rid
of the @warned variable. It is slightly less optimal. But this
is a slow path and the code would be easier.
> > + }
> > + WRITE_ONCE(con->level, -1);
> > + }
> > + console_srcu_read_unlock(cookie);
> > }
> > +
>
Best Regards,
Petr
Powered by blists - more mailing lists