From: Andrew Morton <akpm@linux-foundation.org>
To: Qing Z <njumical@gmail.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,
xjian@marvell.com, zhangwm@marvell.com,
Qing Zhu <qzhu@marvell.com>
Subject: Re: [PATCH] panic: fix incomplete panic log in panic()
Date: Mon, 22 Oct 2012 12:51:03 -0700 [thread overview]
Message-ID: <20121022125103.59a655b7.akpm@linux-foundation.org> (raw)
In-Reply-To: <CAE-am1NxHZ2aGrcwPYxdSXwB-59bf2q9uMwS8gA=Fg9w6LVxFA@mail.gmail.com>
On Mon, 22 Oct 2012 22:54:54 +0800
Qing Z <njumical@gmail.com> wrote:
> Hi Andrew,
> Basically, console_unlock() should be called to make panic
> log printed. Call console_unlock() in panic have some risks when
> recurse in it(are there other bad cases?). The condition is very rare
> and the two issue cases I list always happen between console_lock()
> and console_unlock(). So I think we need to couple with
> console_lock(), but should avoid the case that panic happen in
> console_unlock(). I think it is a more modest and safe way. Please
> corect me if there is something wrong. Thanks!
>
> bool Is_in_console_unlock;
> void console_unlock(void)
> {
> ...
> + Is_in_console_unlock = ture;
> /* flush buffered message fragment immediately to console */
> console_cont_flush(text, sizeof(text));
> again:
> for (;;) {
> ....
> + Is_in_console_unlock = false;
> }
>
> void panic(const char *fmt, ...)
> {
> ....
> + /*
> + * we should unlock console here to make oops log printed, in case
> + * console is locked before panic in this cpu, or other cpus lock the
> + * console before be stopped.
> + */
> + if( unlikely(console_locked) && !Is_in_console_unlock )
> + {
> + console_unlock();
> + console_locked = 0;
> + }
>
> /*
> * Note smp_send_stop is the usual smp shutdown function, which
> * unfortunately means it may not be hardened to work in a panic
> * situation.
> */
> smp_send_stop();
>
> ....
> }
Well, if something like that will solve the problem then yes, I guess
that is the way to go. It's not pretty, but it is clear and direct,
and this isn't a pretty problem!
But is this approach sufficient? What happens in the case of an oops
or a BUG() inside console_lock()?
next prev parent reply other threads:[~2012-10-22 19:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <BD54883EA7DE8B41A61B7E723561C711139F75D348@sc-vexch3.marvell.com>
2012-10-15 11:38 ` [PATCH] panic: fix incomplete panic log in panic() 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 [this message]
2012-10-11 8:03 Qing Zhu
2012-10-11 21:18 ` 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=20121022125103.59a655b7.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=njumical@gmail.com \
--cc=qzhu@marvell.com \
--cc=wwang27@marvell.com \
--cc=xjian@marvell.com \
--cc=zhangwm@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