From: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
To: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Konstantin Khlebnikov <khlebnikov@yandex-team.ru>,
Petr Mladek <pmladek@suse.com>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Steven Rostedt <rostedt@goodmis.org>
Subject: Re: [PATCH] kernel/printk: prevent deadlock at calling kmsg_dump from NMI context
Date: Sat, 13 Jul 2019 22:19:47 +0900 [thread overview]
Message-ID: <20190713131947.GA4464@tigerII.localdomain> (raw)
In-Reply-To: <CALYGNiPedT3wyZ3CrvJra=382g6ETUvrhirHJMb29XkBA3uMyg@mail.gmail.com>
On (07/13/19 09:46), Konstantin Khlebnikov wrote:
> > On (07/12/19 17:54), Konstantin Khlebnikov wrote:
>
> Yep printk() can deal with NMI, but kmsg_dump() is a different beast.
> It reads printk buffer and saves content into persistent storage like ACPI ERST.
Ah, sorry! I misread your patch. Yeah, I see what you are doing.
OK. So, I guess that for kmsg_dump(KMSG_DUMP_PANIC) we should be
fine in general.
We call kmsg_dump(KMSG_DUMP_PANIC) after smp_send_stop() and after
printk_safe_flush_on_panic(). printk_safe_flush_on_panic() resets
the state of logbuf_lock, so logbuf_lock, in general case, should
be unlocked by the time we call kmsg_dump(KMSG_DUMP_PANIC).
Even for nested contexts.
CPU0
printk()
logbuf_lock_irqsave(flags)
-> NMI
panic()
smp_send_stop()
printk_safe_flush_on_panic()
raw_spin_lock_init(&logbuf_lock) << reinit >>
kmsg_dump(KMSG_DUMP_PANIC)
logbuf_lock_irqsave(flags) << expected to be OK >>
So do we have strong reasons to disable NMI->panic->kmsg_dump(DUMP_PANIC)?
Other kmsg_dump(), maybe, can experience some troubles sometimes,
need to check that.
-ss
next prev parent reply other threads:[~2019-07-13 13:20 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-12 14:54 Konstantin Khlebnikov
2019-07-13 6:09 ` Sergey Senozhatsky
2019-07-13 6:46 ` Konstantin Khlebnikov
2019-07-13 13:19 ` Sergey Senozhatsky [this message]
2019-07-13 14:03 ` Konstantin Khlebnikov
2019-07-15 2:33 ` Sergey Senozhatsky
2019-07-15 7:38 ` Konstantin Khlebnikov
2019-07-15 7:54 ` Sergey Senozhatsky
2019-07-15 7:54 ` Petr Mladek
2019-07-15 8:12 ` Konstantin Khlebnikov
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=20190713131947.GA4464@tigerII.localdomain \
--to=sergey.senozhatsky@gmail.com \
--cc=khlebnikov@yandex-team.ru \
--cc=koct9i@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®