From: Andrew Morton <akpm@linux-foundation.org>
To: Hoeun Ryu <hoeun.ryu@lge.com.com>
Cc: Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@suse.de>,
Andi Kleen <ak@linux.intel.com>,
Josh Poimboeuf <jpoimboe@redhat.com>,
"Steven Rostedt (VMware)" <rostedt@goodmis.org>,
Hoeun Ryu <hoeun.ryu@lge.com>,
linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>,
Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH] panic: move bust_spinlocks(0) after console_flush_on_panic() to avoid deadlocks
Date: Wed, 20 Jun 2018 14:30:04 -0700 [thread overview]
Message-ID: <20180620143004.9dd0cf834acfcff5bd1bcb58@linux-foundation.org> (raw)
In-Reply-To: <1528091179-3015-1-git-send-email-hoeun.ryu@lge.com.com>
On Mon, 4 Jun 2018 14:45:57 +0900 Hoeun Ryu <hoeun.ryu@lge.com.com> wrote:
> From: Hoeun Ryu <hoeun.ryu@lge.com>
>
> Many console device drivers hold the uart_port->lock spinlock with irq enabled
> (using spin_lock()) while the device drivers are writing characters to their devices,
> but the device drivers just try to hold the spin lock (using spin_trylock()) if
> "oops_in_progress" is equal or greater than 1 to avoid deadlocks.
>
> There is a case ocurring a deadlock related to the lock and oops_in_progress. A CPU
> could be stopped by smp_send_stop() while it was holding the port lock because irq was
> enabled. Once a CPU stops, it doesn't respond interrupts anymore and the lock stays
> locked forever.
>
> console_flush_on_panic() is called during panic() and it eventually holds the uart
> lock but the lock is held by another stopped CPU and it is a deadlock. By moving
> bust_spinlocks(0) after console_flush_on_panic(), let the console device drivers
> think the Oops is still in progress to call spin_trylock() instead of spin_lock() to
> avoid the deadlock.
hm. Sergey, is this at all related to the UART printk deadlock change
which you're presently discussing in
http://lkml.kernel.org/r/20180615093919.559-1-sergey.senozhatsky@gmail.com?
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -233,8 +233,6 @@ void panic(const char *fmt, ...)
> if (_crash_kexec_post_notifiers)
> __crash_kexec(NULL);
>
> - bust_spinlocks(0);
> -
> /*
> * We may have ended up stopping the CPU holding the lock (in
> * smp_send_stop()) while still having some valuable data in the console
> @@ -246,6 +244,8 @@ void panic(const char *fmt, ...)
> debug_locks_off();
> console_flush_on_panic();
>
> + bust_spinlocks(0);
> +
> if (!panic_blink)
> panic_blink = no_blink;
>
next prev parent reply other threads:[~2018-06-20 21:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 5:45 [PATCH] panic: move bust_spinlocks(0) after console_flush_on_panic() to avoid deadlocks Hoeun Ryu
2018-06-05 1:44 ` Steven Rostedt
2018-06-05 2:23 ` Hoeun Ryu
2018-06-20 21:30 ` Andrew Morton [this message]
2018-06-21 1:23 ` Sergey Senozhatsky
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=20180620143004.9dd0cf834acfcff5bd1bcb58@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ak@linux.intel.com \
--cc=bp@suse.de \
--cc=hoeun.ryu@lge.com \
--cc=hoeun.ryu@lge.com.com \
--cc=jpoimboe@redhat.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sergey.senozhatsky.work@gmail.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;
as well as URLs for NNTP newsgroup(s).