Re: [RFC PATCH v4 0/9] printk: new ringbuffer implementation

Peter Zijlstra
2019-09-08T22:18:28Z

On Fri, Sep 06, 2019 at 04:01:26PM +0200, Peter Zijlstra wrote:
> On Fri, Sep 06, 2019 at 02:42:11PM +0200, Petr Mladek wrote:

> > 7. People would complain when continuous lines become less
> > reliable. It might be most visible when mixing backtraces
> > from all CPUs. Simple sorting by prefix will not make
> > it readable. The historic way was to synchronize CPUs
> > by a spin lock. But then the cpu_lock() could cause
> > deadlock.
>
> Why? I'm running with that thing on, I've never seen a deadlock ever
> because of it. In fact, i've gotten output that is plain impossible with
> the current junk.
>
> The cpu-lock is inside the all-backtrace spinlock, not outside. And as I
> said yesterday, only the lockless console has any wait-loops while
> holding the cpu-lock. It _will_ make progress.

So I've been a huge flaming idiot.. so while I'm not particularly
sympathetic to NMIs that block, there are a number of really trivial
deadlocks possible -- and it is a minor miracle I've not actually hit
them (I suppose because printk() isn't really all that common).

The whole cpu-lock thing I had needs to go. But not having it makes
lockless console output unreadable and unsable garbage.

I've got some ideas on a replacement, but I need to further consider it.

:-/