[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87y1wn3g3g.fsf@jogness.linutronix.de>
Date: Wed, 20 Jul 2022 18:32:43 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
linux-kernel@...r.kernel.org
Cc: Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [PATCH] printk: Skip console drivers on PREEMPT_RT.
Hi Sebastian,
On 2022-07-20, Sebastian Andrzej Siewior <bigeasy@...utronix.de> wrote:
> printk might be invoked in a context with disabled interrupts and or
> preemption and additionally disables interrupts before it invokes the
> console drivers. This is behaviour is not compatible with PREEMPT_RT.
>
> Disable console printing until the return of atomic consoles and the
> printing thread. This allows to retrieve the log buffer from user space
> which is not possible by disable printk.
>
> Signed-off-by: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
> ---
> kernel/printk/printk.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> --- a/kernel/printk/printk.c
> +++ b/kernel/printk/printk.c
> @@ -2843,6 +2843,16 @@ void console_unlock(void)
> }
>
> /*
> + * On PREEMPT_RT it is not possible to invoke console drivers with
> + * disabled interrupts and or preemption. Therefore all drivers are
> + * skipped and the output can be retrieved from the buffer.
> + */
> + if (IS_ENABLED(CONFIG_PREEMPT_RT)) {
> + up_console_sem();
This should be:
__console_unlock();
> + return;
> + }
Note that if @console_may_schedule is 1, then we are in a sleepable
context and could print. But since that is not very often, it is
probably better to just have it off all the time as you propose.
John Ogness
Powered by blists - more mailing lists