All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Wessel <jason.wessel@windriver.com>
To: <akpm@linux-foundation.org>
Cc: <ak@linux.intel.com>, <linux-kernel@vger.kernel.org>
Subject: [PATCH][REGRESSION] panic: fix stack dump print on direct call to panic()
Date: Mon, 9 Apr 2012 12:20:30 -0500	[thread overview]
Message-ID: <1333992030-21181-1-git-send-email-jason.wessel@windriver.com> (raw)

Commit 6e6f0a1f0 (panic: don't print redundant backtraces on oops)
causes a regression where no stack trace will be printed at all for
the case where kernel code calls panic() directly while not processing
an oops, and of course there are 100's of instances of this type of
call.

The original commit executed the check (!oops_in_progress), but this
will always be false because just before the dump_stack() there is a
call to bust_spinlocks(1), which does the following:

  void __attribute__((weak)) bust_spinlocks(int yes)
  {
	if (yes) {
		++oops_in_progress;

The proper way to resolve the problem that original commit tried to
solve is to avoid printing a stack dump from panic() when the either
of the following conditions is true:

  1) TAINT_DIE has been set (this is done by oops_end())
     This indicates and oops has already been printed.
  2) oops_in_progress > 1
     This guards against the rare case where panic() is invoked
     a second time, or in between oops_begin() and oops_end()

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: stable@vger.kernel.org # >= 3.3
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
 kernel/panic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/panic.c b/kernel/panic.c
index 80aed44..8ed89a1 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -97,7 +97,7 @@ void panic(const char *fmt, ...)
 	/*
 	 * Avoid nested stack-dumping if a panic occurs during oops processing
 	 */
-	if (!oops_in_progress)
+	if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
 		dump_stack();
 #endif
 
-- 
1.7.9.4


             reply	other threads:[~2012-04-09 17:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-09 17:20 Jason Wessel [this message]
2012-04-09 18:34 ` [PATCH][REGRESSION] panic: fix stack dump print on direct call to panic() Andi Kleen
2012-04-09 19:08   ` Jason Wessel
2012-04-09 19:36     ` Andi Kleen
2012-04-10 19:19   ` Andrew Morton
2012-04-10 23:29     ` Andi Kleen

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=1333992030-21181-1-git-send-email-jason.wessel@windriver.com \
    --to=jason.wessel@windriver.com \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.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 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.