From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Jann Horn <jannh@google.com>
Cc: Kees Cook <keescook@chromium.org>,
Anton Vorontsov <anton@enomsg.org>,
Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
Ard Biesheuvel <ardb@kernel.org>,
linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] pstore: Don't use semaphores in always-atomic-context code
Date: Fri, 18 Feb 2022 18:49:23 +0100 [thread overview]
Message-ID: <Yg/cIzXsya8dNLYp@linutronix.de> (raw)
In-Reply-To: <20220218172901.1425605-1-jannh@google.com>
On 2022-02-18 18:29:01 [+0100], Jann Horn wrote:
…
> Lockdep probably never caught the problem because it's very rare that you
> actually hit the contended case, and lockdep can't check a
I appears that after ´a' a few words would follow.
> Fixes: ea84b580b955 ("pstore: Convert buf_lock to semaphore")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jann Horn <jannh@google.com>
> ---
> Testing on 5.15.24 (latest stable), with CONFIG_PREEMPT=y, when I trigger
> a BUG() via LKDTM ("echo BUG > /sys/kernel/debug/provoke-crash/DIRECT"),
> I first get the expected BUG splat, followed by this RCU warning:
>
> Voluntary context switch within RCU read-side critical section!
Right, scheduling not allowed within a RCU read-side section. I'm not
sure if lockdep cares but if you enable CONFIG_DEBUG_ATOMIC_SLEEP then
the might_sleep() will complain if you are in a RCU section.
> This patch makes the RCU context warning go away.
Makes sense.
Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
> --- a/fs/pstore/platform.c
> +++ b/fs/pstore/platform.c
> @@ -143,27 +143,26 @@ static void pstore_timer_kick(void)
> mod_timer(&pstore_timer, jiffies + msecs_to_jiffies(pstore_update_ms));
> }
>
> -/*
> - * Should pstore_dump() wait for a concurrent pstore_dump()? If
> - * not, the current pstore_dump() will report a failure to dump
> - * and return.
> - */
> -static bool pstore_cannot_wait(enum kmsg_dump_reason reason)
> +bool pstore_cannot_block_path(enum kmsg_dump_reason reason)
> {
> - /* In NMI path, pstore shouldn't block regardless of reason. */
> + /*
> + * In case of NMI path, pstore shouldn't be blocked
> + * regardless of reason.
> + */
> if (in_nmi())
> return true;
>
> switch (reason) {
> /* In panic case, other cpus are stopped by smp_send_stop(). */
> case KMSG_DUMP_PANIC:
> - /* Emergency restart shouldn't be blocked. */
> + /* Emergency restart shouldn't be blocked by spin lock. */
by spinning on pstore_info::buf_lock
> case KMSG_DUMP_EMERG:
> return true;
> default:
> return false;
> }
> }
> +EXPORT_SYMBOL_GPL(pstore_cannot_block_path);
>
> #if IS_ENABLED(CONFIG_PSTORE_DEFLATE_COMPRESS)
> static int zbufsize_deflate(size_t size)
Sebastian
prev parent reply other threads:[~2022-02-18 17:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-18 17:29 Jann Horn
2022-02-18 17:49 ` Sebastian Andrzej Siewior [this message]
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=Yg/cIzXsya8dNLYp@linutronix.de \
--to=bigeasy@linutronix.de \
--cc=anton@enomsg.org \
--cc=ardb@kernel.org \
--cc=ccross@android.com \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.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
all inboxes | Powered by JetHome®