All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: lkp@lists.01.org
Subject: Re: [panic] [ BUG: bad unlock balance detected! ]
Date: Wed, 18 Nov 2015 10:52:32 +0100	[thread overview]
Message-ID: <87y4dvvdlr.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20151116164300.233add92c0f4b3990ecc3dd6@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 2561 bytes --]

Andrew Morton <akpm@linux-foundation.org> writes:

> On Mon, 16 Nov 2015 11:12:50 +0800 kernel test robot <ying.huang@linux.intel.com> wrote:
>
>> FYI, we noticed the below changes on
>> 
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> commit 08d78658f393fefaa2e6507ea052c6f8ef4002a2 ("panic: release stale console lock to always get the logbuf printed out")
>> 
>> ...
>>
>> [   38.408623] =====================================
>> [   38.408623] [ BUG: bad unlock balance detected! ]
>> [   38.408627] 4.3.0-08150-g08d7865 #1 Not tainted
>> [   38.408627] -------------------------------------
>> [   38.408631] swapper/0/1 is trying to release lock (console_lock) at:
>> [   38.408639] [<ffffffff811a3cb1>] panic+0x124/0x213
>> [   38.408640] but there are no more locks to release!
>> [   38.408641] 
>> [   38.408641] other info that might help us debug this:
>> [   38.408642] 2 locks held by swapper/0/1:
>> [   38.408651]  #0:  (oom_lock){+.+...}, at: [<ffffffff811add45>] __alloc_pages_slowpath+0x5bd/0x68d
>> [   38.408656]  #1:  (panic_lock){......}, at: [<ffffffff811a3bd9>] panic+0x4c/0x213
>> [   38.408657] 
>> [   38.408657] stack backtrace:
>> [   38.408659] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-08150-g08d7865 #1
>> [   38.408660] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
>> [   38.408665]  0000000000000000 ffff8800132bba78 ffffffff8173760d ffff8800132b4040
>> [   38.408668]  ffff8800132bbaa0 ffffffff8111328c 00000000ffffffff ffff8800132b4040
>> [   38.408670]  ffffffff8406a080 ffff8800132bbb18 ffffffff8111626c ffffffff811139d1
>> [   38.408671] Call Trace:
>> [   38.408678]  [<ffffffff8173760d>] dump_stack+0x4b/0x63
>> [   38.408682]  [<ffffffff8111328c>] print_unlock_imbalance_bug+0xc7/0xd0
>
> Yup, we can't have this happen.
>
> Can we instead do this?
>
> 	if (is_console_locked())
> 		console_unlock();
>
> It's racy,

Well, at this point all other CPUs are supposed to be stopped by
smp_send_stop() (first by IPIs and then by NMIs).

> but more accurate than what we have now?

Yes, but it won't solve the issue - lockdep is complaining because *we*
didn't take take the lock we're trying to release. I suggest to disable
lockdep here (it is already disabled on OOPS, but if panic() is called
directly it is not -- I didn't test this case and that's what actually
happens on OOM above), please see my "[PATCH] panic: turn off locks
debug before releasing console lock".

-- 
  Vitaly

WARNING: multiple messages have this Message-ID (diff)
From: Vitaly Kuznetsov <vkuznets@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: kernel test robot <ying.huang@linux.intel.com>,
	lkp@01.org, LKML <linux-kernel@vger.kernel.org>,
	Jan Kara <jack@suse.cz>, "K. Y. Srinivasan" <kys@microsoft.com>,
	Seth Jennings <sjenning@redhat.com>,
	Xie XiuQi <xiexiuqi@huawei.com>,
	Prarit Bhargava <prarit@redhat.com>, Baoquan He <bhe@redhat.com>,
	Jiri Kosina <jkosina@suse.cz>,
	Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>,
	HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [lkp] [panic] [ BUG: bad unlock balance detected! ]
Date: Wed, 18 Nov 2015 10:52:32 +0100	[thread overview]
Message-ID: <87y4dvvdlr.fsf@vitty.brq.redhat.com> (raw)
In-Reply-To: <20151116164300.233add92c0f4b3990ecc3dd6@linux-foundation.org> (Andrew Morton's message of "Mon, 16 Nov 2015 16:43:00 -0800")

Andrew Morton <akpm@linux-foundation.org> writes:

> On Mon, 16 Nov 2015 11:12:50 +0800 kernel test robot <ying.huang@linux.intel.com> wrote:
>
>> FYI, we noticed the below changes on
>> 
>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
>> commit 08d78658f393fefaa2e6507ea052c6f8ef4002a2 ("panic: release stale console lock to always get the logbuf printed out")
>> 
>> ...
>>
>> [   38.408623] =====================================
>> [   38.408623] [ BUG: bad unlock balance detected! ]
>> [   38.408627] 4.3.0-08150-g08d7865 #1 Not tainted
>> [   38.408627] -------------------------------------
>> [   38.408631] swapper/0/1 is trying to release lock (console_lock) at:
>> [   38.408639] [<ffffffff811a3cb1>] panic+0x124/0x213
>> [   38.408640] but there are no more locks to release!
>> [   38.408641] 
>> [   38.408641] other info that might help us debug this:
>> [   38.408642] 2 locks held by swapper/0/1:
>> [   38.408651]  #0:  (oom_lock){+.+...}, at: [<ffffffff811add45>] __alloc_pages_slowpath+0x5bd/0x68d
>> [   38.408656]  #1:  (panic_lock){......}, at: [<ffffffff811a3bd9>] panic+0x4c/0x213
>> [   38.408657] 
>> [   38.408657] stack backtrace:
>> [   38.408659] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.3.0-08150-g08d7865 #1
>> [   38.408660] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014
>> [   38.408665]  0000000000000000 ffff8800132bba78 ffffffff8173760d ffff8800132b4040
>> [   38.408668]  ffff8800132bbaa0 ffffffff8111328c 00000000ffffffff ffff8800132b4040
>> [   38.408670]  ffffffff8406a080 ffff8800132bbb18 ffffffff8111626c ffffffff811139d1
>> [   38.408671] Call Trace:
>> [   38.408678]  [<ffffffff8173760d>] dump_stack+0x4b/0x63
>> [   38.408682]  [<ffffffff8111328c>] print_unlock_imbalance_bug+0xc7/0xd0
>
> Yup, we can't have this happen.
>
> Can we instead do this?
>
> 	if (is_console_locked())
> 		console_unlock();
>
> It's racy,

Well, at this point all other CPUs are supposed to be stopped by
smp_send_stop() (first by IPIs and then by NMIs).

> but more accurate than what we have now?

Yes, but it won't solve the issue - lockdep is complaining because *we*
didn't take take the lock we're trying to release. I suggest to disable
lockdep here (it is already disabled on OOPS, but if panic() is called
directly it is not -- I didn't test this case and that's what actually
happens on OOM above), please see my "[PATCH] panic: turn off locks
debug before releasing console lock".

-- 
  Vitaly

  reply	other threads:[~2015-11-18  9:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-16  3:12 [panic] [ BUG: bad unlock balance detected! ] kernel test robot
2015-11-16  3:12 ` [lkp] " kernel test robot
2015-11-17  0:43 ` Andrew Morton
2015-11-17  0:43   ` [lkp] " Andrew Morton
2015-11-18  9:52   ` Vitaly Kuznetsov [this message]
2015-11-18  9:52     ` Vitaly Kuznetsov

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=87y4dvvdlr.fsf@vitty.brq.redhat.com \
    --to=vkuznets@redhat.com \
    --cc=lkp@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.