mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] panic: turn off locks debug before releasing console lock
@ 2015-11-16 18:20 Vitaly Kuznetsov
  0 siblings, 0 replies; only message in thread
From: Vitaly Kuznetsov @ 2015-11-16 18:20 UTC (permalink / raw)
  To: Andrew Morton
  Cc: linux-kernel, HATAYAMA Daisuke, Masami Hiramatsu, Jiri Kosina,
	Baoquan He, Prarit Bhargava, Xie XiuQi, Seth Jennings,
	K. Y. Srinivasan, Jan Kara, Petr Mladek, Yasuaki Ishimatsu

Commit 08d78658f393 ("panic: release stale console lock to always get the
logbuf printed out") introduced unwanted bad unlock balance report when
panic() is called directly and not from OOPS (e.g. from out_of_memory()).
The difference is that in case of OOPS we disable locks debug in
oops_enter() and on direct panic call nobody does that.

Fixes: 08d78658f393 ("panic: release stale console lock to always get the logbuf printed out")
Reported-by: kernel test robot <ying.huang@linux.intel.com>
Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Cc: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Baoquan He <bhe@redhat.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Xie XiuQi <xiexiuqi@huawei.com>
Cc: Seth Jennings <sjenning@redhat.com>
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Petr Mladek <pmladek@suse.cz>
Cc: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
---
The original plan was to replace this patch with less hackish implementation
from Jan's "printk: Softlockup avoidance" series but it seems it didn't get
merged in 4.4 so we still need some band-aid for now.
---
 kernel/panic.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 4579dbb..4b150bc 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -152,8 +152,11 @@ void panic(const char *fmt, ...)
 	 * We may have ended up stopping the CPU holding the lock (in
 	 * smp_send_stop()) while still having some valuable data in the console
 	 * buffer.  Try to acquire the lock then release it regardless of the
-	 * result.  The release will also print the buffers out.
+	 * result.  The release will also print the buffers out.  Locks debug
+	 * should be disabled to avoid reporting bad unlock balance when
+	 * panic() is not being callled from OOPS.
 	 */
+	debug_locks_off();
 	console_trylock();
 	console_unlock();
 
-- 
2.4.3


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-11-16 18:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-16 18:20 [PATCH] panic: turn off locks debug before releasing console lock Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome