mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Byungchul Park <byungchul.park@lge.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: akpm@linux-foundation.org, mingo@kernel.org,
	linux-kernel@vger.kernel.org, akinobu.mita@gmail.com,
	jack@suse.cz, peter@hurleysoftware.com, tglx@linutronix.de,
	peterz@infradead.org, rostedt@goodmis.org
Subject: Re: [PATCH v6 2/2] printk: Make printing of spin_dump() deferred to avoid a deadlock
Date: Wed, 16 Mar 2016 11:06:29 +0900	[thread overview]
Message-ID: <20160316020629.GH5220@X58A-UD3R> (raw)
In-Reply-To: <20160314041747.GF5220@X58A-UD3R>

On Mon, Mar 14, 2016 at 01:17:48PM +0900, Byungchul Park wrote:
> On Mon, Mar 14, 2016 at 11:40:55AM +0900, Sergey Senozhatsky wrote:
> > Hi,
> > 
> > On (03/14/16 11:30), Byungchul Park wrote:
> > [..]
> > > > so can it be
> > > > 
> > > > vprintk_emit()
> > > >  __spin_dump_deferred()
> > > >   vprintk_deferred()
> > > >    vprintk_emit()
> > > >     __spin_dump_deferred()
> > >       ^^^
> > >       can be caused by raw_spin_lock(logbug_lock)
> > > 
> > > >      vprintk_deferred()
> > > 
> > > Yes, it can happen by raw_spin_lock(logbuf_lock) to print warning or error
> > > message. Are you worrying about an infinite recursion?
> > 
> > yes.
> > 
> > > 1. In the case printing warning, eventually it can fill the buffer without
> > > actual printing using console.
> > 
> > so the worry is that the CPU that spins on __spin_dump_deferred() has IRQs
> > disabled and `printk_pending' bit set; but IRQ may never be enabled on this
> > CPU.
> 
> It's true if another cpu never release the logbug_lock. But it's another
> problem which current code already has and must be solved by another way.
> IOW, the situation where the logbug_lock is not held yet is not the case
> where we need to worry about whether the "IRQ work queue" works or not.

To add more explanation,

1. If another cpu never release the logbug_lock, then the both current code
and patched code will suffer from an infinite recursive by vprintk_emit ->
spin_dump -> vprintk_emit -> ... It should be solved by another way if we
define this is a problem (even it's not a problem currently).

2. If another cpu eventually release the logbug_lock, then the both current
code and patched code can obtain the lock and get out of the recursive. And
the "IRQ work queue" can work when the irq is finally enabled. That's no
problem. This is what I wanted to say.

> 
> > 
> > > 2. In the case printing error, the infinite recursion can be prevented by
> > > debug_locks_off().
> > > 
> > > Therefore, no problem.
> > 
> > 	-ss

  reply	other threads:[~2016-03-16  2:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-11 10:37 [PATCH v6 0/2] " Byungchul Park
2016-03-11 10:37 ` [PATCH v6 1/2] printk: Factor out buffering and irq work queuing in printk_deferred Byungchul Park
2016-03-14  1:21   ` Sergey Senozhatsky
2016-03-14  4:45     ` Byungchul Park
2016-03-11 10:37 ` [PATCH v6 2/2] printk: Make printing of spin_dump() deferred to avoid a deadlock Byungchul Park
2016-03-14  1:37   ` Sergey Senozhatsky
2016-03-14  2:30     ` Byungchul Park
2016-03-14  2:40       ` Sergey Senozhatsky
2016-03-14  4:17         ` Byungchul Park
2016-03-16  2:06           ` Byungchul Park [this message]
2016-03-18  5:55 ` [PATCH] lib/spinlock_debug: Prevent a unnecessary recursive spin_dump() Byungchul Park

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=20160316020629.GH5220@X58A-UD3R \
    --to=byungchul.park@lge.com \
    --cc=akinobu.mita@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=tglx@linutronix.de \
    /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

all inboxes | Powered by JetHome®