Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1503229

Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls
Date 2016-10-18 19:10 +0200
Message-ID <stG3L-4JB-3@gated-at.bofh.it> (permalink)
References <stEOm-3Fs-11@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed, Oct 19, 2016 at 12:40:39AM +0900, Sergey Senozhatsky wrote:
> Hello,
> 
>         RFC
> 
>         This patch set extends a lock-less NMI per-cpu buffers idea to
> handle recursive printk() calls. The basic mechanism is pretty much the
> same -- at the beginning of a deadlock-prone section we switch to lock-less
> printk callback, and return back to a default printk implementation at the
> end; the messages are getting flushed to a logbuf buffer from a safer
> context.

So I think you're not taking this far enough. You've also missed an
entire class of deadlocks.

The first is that you still keep the logbuf. Having this global
serialized thing is a source of fail. It would be much better to only
keep per cpu stuff. _OR_ at the very least make the logbuf itself
lockfree. So generate the printk entry local (so we know its size) then
atomically reserve the logbuf entry and copy it over.

The entire class of deadlocks you've missed is that console->write() is
a piece of crap too ;-) Even the bog standard 8250 serial console driver
can do wakeups.

See for example:

  https://marc.info/?l=linux-kernel&m=132446649823347&w=2


I've entirely given up on printk(), I'll post the 3 patches I carry to
make things work for me.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-18 17:50 +0200
  [RFC][PATCHv3 5/6] printk: use printk_safe buffers Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-18 17:50 +0200
  [RFC][PATCHv3 2/6] printk: rename nmi.c and exported api Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-18 17:50 +0200
    Re: [RFC][PATCHv3 2/6] printk: rename nmi.c and exported api Steven Rostedt <rostedt@goodmis.org> - 2016-10-18 18:50 +0200
      Re: [RFC][PATCHv3 2/6] printk: rename nmi.c and exported api Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-10-19 04:00 +0200
  [RFC][PATCHv3 6/6] printk: remove zap_locks() function Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-18 17:50 +0200
  [RFC][PATCHv3 4/6] printk: report lost messages in printk safe/nmi contexts Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-18 17:50 +0200
  Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Joe Perches <joe@perches.com> - 2016-10-18 18:50 +0200
    Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-10-19 03:20 +0200
  Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Peter Zijlstra <peterz@infradead.org> - 2016-10-18 19:10 +0200
    Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-10-19 04:00 +0200
      Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Peter Zijlstra <peterz@infradead.org> - 2016-10-19 18:20 +0200
    Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Peter Zijlstra <peterz@infradead.org> - 2016-10-19 16:30 +0200
      Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-10-20 15:20 +0200
    Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Petr Mladek <pmladek@suse.com> - 2016-10-19 16:40 +0200
  Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk()  recursive calls Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-10-19 06:40 +0200

csiph-web