Re: [PATCH v6 1/3] printk: Add line-buffered printk() API.
From: Tetsuo Handa
Date: Mon Nov 12 2018 - 05:42:28 EST
On 2018/11/12 16:59, Sergey Senozhatsky wrote:
> Tetsuo, lockdep report with buffered printks looks a bit different:
>
> kernel: Possible unsafe locking scenario:
> kernel: CPU0 CPU1
> kernel: ---- ----
> kernel: lock(bar_lock);
> kernel: lock(
> kernel: foo_lock);
> kernel: lock(bar_lock);
> kernel: lock(foo_lock);
> kernel:
>
Yes. That is because vprintk_buffered() eliminated KERN_CONT.
Since there was pending partial printk() output, vprintk_buffered()
should not eliminate KERN_CONT. Petr Mladek commented
1. The mixing of normal and buffered printk calls is a bit confusing
and error prone. It would make sense to use the buffered printk
everywhere in the given section of code even when it is not
strictly needed.
and I made a draft version for how the code would look like if we try to
avoid the mixing of normal and buffered printk calls. The required changes
seem to be too large to apply tree wide. And I suggested try_buffered_printk().