Re: [PATCH] printk: Skip console drivers on PREEMPT_RT.

From: Sebastian Andrzej Siewior
Date: Wed Jul 20 2022 - 12:35:56 EST


On 2022-07-20 18:32:43 [+0206], John Ogness wrote:
> Hi Sebastian,
Hi,

> > --- 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();

Why?

> > + 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.

No we can't coz printk disables interrupts before invoking the console
drivers.

> John Ogness

Sebastian