linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
To: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Cc: Petr Mladek <pmladek@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Jan Kara <jack@suse.cz>, Tejun Heo <tj@kernel.org>,
	Calvin Owens <calvinowens@fb.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Mel Gorman <mgorman@techsingularity.net>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	linux-kernel@vger.kernel.org,
	Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Subject: Re: [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls
Date: Wed, 19 Oct 2016 13:33:25 +0900	[thread overview]
Message-ID: <20161019043325.GA444@swordfish> (raw)
In-Reply-To: <20161018154045.7364-1-sergey.senozhatsky@gmail.com>

On (10/19/16 00:40), Sergey Senozhatsky wrote:
[..]
> Deadlock scenarios that printk_safe can handle:
> 
> a) printk recursion from logbuf_lock spin_lock section in printk()
>   printk()
>     raw_spin_lock(&logbuf_lock);
>     WARN_ON(1);
>     raw_spin_unlock(&logbuf_lock);
> 
> b) printk from sem->lock spin_lock section
>   printk()
>     console_trylock()
>       down_trylock()
>         raw_spin_lock_irqsave(&sem->lock, flags);
>         WARN_ON(1);
>         raw_spin_unlock_irqrestore(&sem->lock, flags);
> 
> c) printk from logbuf_lock spin_lock section in console_unlock()
>   printk()
>     console_unlock()
>       raw_spin_lock(&logbuf_lock);
>       WARN_ON(1);
>       raw_spin_unlock(&logbuf_lock);
> 
> d) printk from ->pi_lock from semaphore up
>   printk()
>     console_unlock()
>       up()
>         try_to_wake_up()
>           raw_spin_lock_irqsave(&p->pi_lock, flags);
>           WARN_ON(1);
>           raw_spin_unlock_irqrestore(&p->pi_lock, flags);

and

e) anything from call_console_drivers() should be fine as well.
   console_unlock() big printing loop is covered by printk_safe,
   need to protect console_cont_flush()->call_console_drivers().

   so printk "direct path" seems to be safe now:

   printk -> .. -> console_unlock() -> call_console_drivers() -> serial_console_write()

   anything that is "indirect" is not covered in this patch set.


	-ss

      parent reply	other threads:[~2016-10-19  4:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-18 15:40 [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls Sergey Senozhatsky
2016-10-18 15:40 ` [RFC][PATCHv3 1/6] printk: use vprintk_func in vprintk() Sergey Senozhatsky
2016-10-18 16:49   ` Steven Rostedt
2016-10-19  1:54     ` Sergey Senozhatsky
2016-10-18 15:40 ` [RFC][PATCHv3 2/6] printk: rename nmi.c and exported api Sergey Senozhatsky
2016-10-18 16:49   ` Steven Rostedt
2016-10-19  1:54     ` Sergey Senozhatsky
2016-10-18 15:40 ` [RFC][PATCHv3 3/6] printk: introduce per-cpu safe_print seq buffer Sergey Senozhatsky
2016-10-18 16:46   ` Steven Rostedt
2016-10-19  1:10     ` Sergey Senozhatsky
2016-10-19 13:42   ` Sergey Senozhatsky
2016-10-18 15:40 ` [RFC][PATCHv3 4/6] printk: report lost messages in printk safe/nmi contexts Sergey Senozhatsky
2016-10-18 15:40 ` [RFC][PATCHv3 5/6] printk: use printk_safe buffers Sergey Senozhatsky
2016-10-18 15:40 ` [RFC][PATCHv3 6/6] printk: remove zap_locks() function Sergey Senozhatsky
2016-10-18 16:45 ` [RFC][PATCHv3 0/6] printk: use printk_safe to handle printk() recursive calls Joe Perches
2016-10-19  1:14   ` Sergey Senozhatsky
2016-10-18 17:07 ` Peter Zijlstra
2016-10-19  1:53   ` Sergey Senozhatsky
2016-10-19  9:30     ` Peter Zijlstra
2016-10-19 13:18   ` Petr Mladek
2016-10-19 13:34     ` Peter Zijlstra
2016-10-20 13:18       ` Sergey Senozhatsky
2016-10-19  4:33 ` Sergey Senozhatsky [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161019043325.GA444@swordfish \
    --to=sergey.senozhatsky.work@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=calvinowens@fb.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@techsingularity.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky@gmail.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).