On (04/25/18 16:48), Petr Mladek wrote:
[..]
> 
> The above paragraph is not easy to understand. I wonder if the
> following might be more clear:
> 
> "Calling console drivers from printk_safe() context does not really
> make call_console_drivers() any safer. They are never called
> recursively thanks to console_trylock() in vprintk_emit()."

Yes, looks good.

[..]
> Unfortunately printk_safe context helps only when console_unlock() is
> called with IRQs disabled. Otherwise, the per-CPU buffer is flushed
> in every for(;;) cycle.

Right. I thought about it. If console_unlock() is called with IRQs
disabled then we postpone flush until we return from console_unlock()
and enable local IRQs. But then we have printk_safe() flush, which
uses printk_deferred() -> queue irq_work -> irq work -> console_unlock(),
so quite likely we still print out printk_safe() buffer from atomic
context (from irq in this case).

> So I agree that printk_safe context does not help much. And I fine
> with this patch.

Thanks.

        -ss

Reply via email to