[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZoPIvPtN1rmrds4a@pathway.suse.cz>
Date: Tue, 2 Jul 2024 11:30:36 +0200
From: Petr Mladek <pmladek@...e.com>
To: John Ogness <john.ogness@...utronix.de>
Cc: Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH printk v2 12/18] printk: Add kthread for all legacy
consoles
On Mon 2024-07-01 16:50:31, Petr Mladek wrote:
> On Fri 2024-06-28 16:17:13, John Ogness wrote:
> > On 2024-06-28, Petr Mladek <pmladek@...e.com> wrote:
> > > On Fri 2024-06-28 14:28:47, John Ogness wrote:
> > >> On 2024-06-28, Petr Mladek <pmladek@...e.com> wrote:
> > >> >> @@ -1494,7 +1508,9 @@ void nbcon_cpu_emergency_exit(void)
> > >> >> * to handle it.
> > >> >> */
> > >> >> do_trigger_flush = true;
> > >> >> - if (printing_via_unlock && !is_printk_deferred()) {
> > >> >> + if (!force_printkthreads() &&
> > >> >
> > >> > Is this correct? We still need to flush the messages directly
> > >> > when the legacy kthread is not ready yet.
> > >>
> > >> No! If force_printkthreads() is set, messages will never flush directly
> > >> except for console_flush_on_panic().
> > >
> > > But this is an _emergency_ context! This would be inconsistent with
> > > the nbcon consoles where the messages are flushed directly.
> > >
> > > Is RT sheduling quaranteed when the system reached emergency state?
> >
> > No.
> >
> > > In fact, we probably should not check force_printkthreads() here at
> > > all. It would be only for NBCON_PRIO_NORMAL context.
> >
> > On PREEMPT_RT, legacy consoles are not allowed to print from
> > non-preemptible contexts because they use spinlocks (rtmutexes).
>
> Ah, I see.
>
> > This is a disadvantage for legacy consoles on PREEMPT_RT. If people want
> > a legacy console to gain the reliability attribute on PREEMPT_RT, then
> > that console _must_ be converted to nbcon.
>
> Makes sense.
>
> Thanks a lot for explanation.
It is clear that the legacy consoles could not be flushed directly in
nbcon_cpu_emergency_exit() with PREEMPT_RT. I thought whether we
could/should allow this for other preemption modes.
My opinion. Let's keep it simple and behave the same in all preemption
modes. force_printkthreads() is enabled only in PREEMPT_RT by default.
Users would get the "expected" legacy behavior in other preemption
modes by default.
By other words, let's keep "force_printkthreads()" to really simulate
RT behavior also in other preemption modes.
That said, I still suggest to rename the variable/function to
"force_legacy_thread". It does not affect the behavior of
the kthreads for nbcon consoles.
Best Regards,
Petr
Powered by blists - more mailing lists