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


Groups > linux.kernel > #1546792

Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk
Date 2016-12-23 11:00 +0100
Message-ID <sRuNU-5dQ-7@gated-at.bofh.it> (permalink)
References <sQQdH-4Cy-3@gated-at.bofh.it> <sQQdI-4Cy-21@gated-at.bofh.it> <sR4gF-5aJ-11@gated-at.bofh.it> <sRfc6-3Sa-23@gated-at.bofh.it> <sRn9E-jk-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Fri 2016-12-23 10:46:43, Sergey Senozhatsky wrote:
> not every switch to printk_safe is "dictated" by logbuf_lock.
> down_trylock_console_sem(), for instance, takes semaphore spin_lock
> which already may be locked on the same CPU (*), so we need to be
> in safe mode:
> 
> vprintk_emit()
>  down_trylock()
>   raw_spin_lock_irqsave(&sem->lock, flags);
>   ...
>   raw_spin_unlock_irqrestore(&sem->lock, flags);
>    spin_dump()
>     printk()
>      vprintk_emit()
>       down_trylock()
>        raw_spin_lock_irqsave(&sem->lock, flags)   << deadlock
> 
> 
> and so on. IOW, "printk_save_enter()" != "logbuf_lock is acquired".

You are right. It seems that the

printk_safe_enter_irq()
printk_safe_exit_irq()

printk_safe_enter_irqsave(flags)
printk_safe_exit_irqrestore(flags)

variants make sense and we will need them together with
the logbuf_lock_*() stuff.

> [..]
> > PS: I still think if we could come with a better name than
> > printk_safe() but I cannot find one.
> 
> well, not that I'm the fan of printk_safe name, but can't think
> of anything better. we make printk calls safe (deadlock safe) in
> places where previously it was unsafe... quick-&-dirty name that
> is implementation-specific -- printk_percpu_enter/exit, or
> printk_pcpu_enter/exit... dunno.

OK, let's stay with printk_safe :-)

Best Reagards,
Petr

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


Thread

[PATCHv6 0/7] printk: use printk_safe to handle printk() recursive calls Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:40 +0100
  [PATCHv6 6/7] printk: use printk_safe buffers in printk Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:40 +0100
    Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-12-22 06:40 +0100
      Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk Petr Mladek <pmladek@suse.com> - 2016-12-22 18:20 +0100
        Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-12-23 02:50 +0100
          Re: [PATCHv6 6/7] printk: use printk_safe buffers in printk Petr Mladek <pmladek@suse.com> - 2016-12-23 11:00 +0100
  [PATCHv6 7/7] printk: remove zap_locks() function Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:40 +0100
  [PATCHv6 2/7] printk: rename nmi.c and exported api Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:40 +0100
    Re: [PATCHv6 2/7] printk: rename nmi.c and exported api Linus Torvalds <torvalds@linux-foundation.org> - 2016-12-21 20:50 +0100
      Re: [PATCHv6 2/7] printk: rename nmi.c and exported api Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-12-22 02:20 +0100
  [PATCHv6 1/7] printk: use vprintk_func in vprintk() Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:40 +0100
  [PATCHv6 4/7] printk: always use deferred printk when flush printk_safe lines Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:50 +0100
  [PATCHv6 3/7] printk: introduce per-cpu safe_print seq buffer Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-12-21 15:50 +0100
    Re: [PATCHv6 3/7] printk: introduce per-cpu safe_print seq buffer Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-12-22 02:20 +0100
      Re: [PATCHv6 3/7] printk: introduce per-cpu safe_print seq buffer Petr Mladek <pmladek@suse.com> - 2016-12-22 17:40 +0100

csiph-web