Re: [RFC PATCH v1 08/25] printk: add ring buffer and kthread

From: Petr Mladek
Date: Fri Mar 08 2019 - 05:04:55 EST


On Fri 2019-03-08 10:31:34, Sergey Senozhatsky wrote:
> On (03/07/19 13:06), John Ogness wrote:
> > On 2019-03-04, Sergey Senozhatsky <sergey.senozhatsky.work@xxxxxxxxx> wrote:
> > > This, theoretically, creates a whole new world of possibilities for
> > > console drivers. Now they can do GFP_KERNEL allocations and stall
> > > printk_kthread during OOM; or they can explicitly reschedule from
> > > ->write() callback (via console_conditional_schedule()) because
> > > console_lock() sets console_may_schedule.
> >
> This can stall the entire printing pipeline
>
> OOM -> printk_kthread() -> console_lock() -> con_foo() -> kmalloc(GFP_KERNEL) -> OOM
>
> > Although, as I mentioned in a previous response[0], perhaps we should
> > not loosen the requirements on write().
>
> Right. Console drivers better stay restricted; very restricted.

I agree here.

> > It is exactly that disable_preempt() that is so harmful for realtime tasks.

> I'll reply in another email (later today, or tomorrow).

I see. But I have troubles to imagine a preemtible direct console
output. The result would be mixed messages on a single line.

Best Regards,
Petr