From: Andrew Morton <akpm@linux-foundation.org>
To: Qing Zhu <qzhu@marvell.com>
Cc: mingo@kernel.org, ben@decadent.org.uk, markivx@codeaurora.org,
ak@linux.intel.com, linux-kernel@vger.kernel.org,
cxie4@marvell.com, binw@marvell.com, wwang27@marvell.com,
njun@marvell.com
Subject: Re: [PATCH] panic: fix incomplete panic log in panic()
Date: Thu, 11 Oct 2012 14:18:45 -0700 [thread overview]
Message-ID: <20121011141845.1ed347df.akpm@linux-foundation.org> (raw)
In-Reply-To: <1349942587-16134-1-git-send-email-qzhu@marvell.com>
On Thu, 11 Oct 2012 16:03:07 +0800
Qing Zhu <qzhu@marvell.com> wrote:
> Panic log should be printed on the console, but if someone lock the
> console when panic, console won't print out panic log.
>
> The incomplete panic log issue will happen in below scenarios:
> 1. One task call console_lock(), then panic happend before it call
> console_unlock(). No panic log can be printed.
> 2. Cpu 0 call panic()->Cpu 1 call console_lock()->Cpu 0 call
> smp_send_stop()
> Cpu 1 will be stopped and can't unlock console,only top part of panic log
> will be printed.
>
> So unlock console anyway in panic() to keep panic log printed.
>
> Signed-off-by: Qing Zhu <qzhu@marvell.com>
> ---
> kernel/panic.c | 8 ++++++++
> 1 files changed, 8 insertions(+), 0 deletions(-)
>
> diff --git a/kernel/panic.c b/kernel/panic.c
> index e1b2822..3924d25 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -23,6 +23,7 @@
> #include <linux/init.h>
> #include <linux/nmi.h>
> #include <linux/dmi.h>
> +#include <linux/console.h>
>
> #define PANIC_TIMER_STEP 100
> #define PANIC_BLINK_SPD 18
> @@ -127,6 +128,13 @@ void panic(const char *fmt, ...)
>
> atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
>
> + /*
> + * Unlock the console anyway here, in case it's occupied by another
> + * one which has no chance to unlock the console thus prevents the
> + * panic log prints on the console.
> + */
> + console_unlock();
> +
> bust_spinlocks(0);
>
> if (!panic_blink)
hm. console_unlock() does a large amount of work, and it seems risky
to do all of that when the system is in a bad-and-getting-worse state.
Is there some more modest thing we could do here, for example,
if (console_locked) {
up(&console_sem);
console_locked = 0;
}
or something along those lines?
Also, perhaps this operation should be moved into bust_spinlocks().
What would have happened if your code had triggered an oops, rather
than called panic()?
next prev parent reply other threads:[~2012-10-11 21:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-11 8:03 [PATCH] panic: fix incomplete panic log in panic() Qing Zhu
2012-10-11 21:18 ` Andrew Morton [this message]
[not found] <BD54883EA7DE8B41A61B7E723561C711139F75D348@sc-vexch3.marvell.com>
2012-10-15 11:38 ` Qing Z
2012-10-15 22:02 ` Andrew Morton
2012-10-15 22:06 ` Andi Kleen
2012-10-16 14:25 ` Qing Z
2012-10-17 10:44 ` Qing Z
2012-10-18 0:06 ` Andrew Morton
2012-10-22 14:54 ` Qing Z
2012-10-22 19:51 ` Andrew Morton
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=20121011141845.1ed347df.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ak@linux.intel.com \
--cc=ben@decadent.org.uk \
--cc=binw@marvell.com \
--cc=cxie4@marvell.com \
--cc=linux-kernel@vger.kernel.org \
--cc=markivx@codeaurora.org \
--cc=mingo@kernel.org \
--cc=njun@marvell.com \
--cc=qzhu@marvell.com \
--cc=wwang27@marvell.com \
/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