public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: "Jonathan Neuschäfer" <j.neuschaefer@gmx.net>,
	"Andy Lutomirski" <luto@amacapital.net>,
	LKML <linux-kernel@vger.kernel.org>,
	"Theodore Ts'o" <tytso@mit.edu>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Will Deacon" <will@kernel.org>,
	"Waiman Long" <longman@redhat.com>,
	"Boqun Feng" <boqun.feng@gmail.com>
Subject: Re: "BUG: Invalid wait context" in invalidate_batched_entropy
Date: Fri, 28 Jan 2022 17:19:13 +0100	[thread overview]
Message-ID: <YfQXgaAyBBEYSspV@linutronix.de> (raw)
In-Reply-To: <CAHmME9qBj2gL=spp3AUEo-Ri4r0KQq-KrR-f6dG++xXQvzcA7A@mail.gmail.com>

On 2022-01-28 17:04:13 [+0100], Jason A. Donenfeld wrote:
> Hi Sebastian/Jonathan,
> 
> On Fri, Jan 28, 2022 at 9:35 AM Sebastian Andrzej Siewior
> <bigeasy@linutronix.de> wrote:
> > This report is due to CONFIG_PROVE_LOCKING=y _and_
> > CONFIG_PROVE_RAW_LOCK_NESTING=y. It reports a nesting problem
> > (raw_spinlock_t -> spinlock_t lock ordering) which becomes a real
> > problem on PREEMPT_RT.
> 
> Hmm, I'm still having a tough time reproducing this. I'm trying to
> understand your intuition. Is the problem you see that something else
> in the IRQ path uses a raw_spinlock_t, and then with that lock still
> held, we call invalidate_batched_entropy(), which takes an ordinary
> spinlock_t, non-raw? And taking a spinlock-t while holding a
> raw_spinlock_t is illegal?

Correct. You must not acquire a spinlock_t while holding a
raw_spinlock_t. This is because on PREEMPT_RT the spinlock_t is a
sleeping lock while raw_spinlock_t disables preemption/ interrupts and
sleeping is not possible.
	Documentation/locking/locktypes.rst

On non-PREEMPT both lock types (spinlock_t & raw_spinlock_t) behave in
the same way but lockdep can tell them apart with
CONFIG_PROVE_RAW_LOCK_NESTING=y and show code that is problematic on RT.

> Jason

Sebastian

  reply	other threads:[~2022-01-28 16:19 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-27 22:21 "BUG: Invalid wait context" in invalidate_batched_entropy Jonathan Neuschäfer
2022-01-27 22:26 ` Jason A. Donenfeld
2022-01-28  8:34   ` Sebastian Andrzej Siewior
2022-01-28 16:04     ` Jason A. Donenfeld
2022-01-28 16:19       ` Sebastian Andrzej Siewior [this message]
2022-01-28 16:28         ` Jason A. Donenfeld
2022-01-28 17:02           ` Sebastian Andrzej Siewior
2022-01-28 15:33   ` [PATCH] random: remove batched entropy locking Jason A. Donenfeld
2022-01-28 15:44     ` Sebastian Andrzej Siewior
2022-01-28 15:54       ` Jason A. Donenfeld
2022-01-28 16:15         ` Sebastian Andrzej Siewior
2022-01-28 16:36           ` Jason A. Donenfeld
2022-01-28 15:48     ` Jason A. Donenfeld
2022-01-28 22:35       ` [PATCH v2] " Jason A. Donenfeld
2022-01-29 21:03         ` Jonathan Neuschäfer
2022-02-04  0:27         ` Jason A. Donenfeld
2022-02-04 11:10           ` Sebastian Andrzej Siewior
2022-02-04 13:42             ` Jason A. Donenfeld
2022-02-04 14:01               ` Sebastian Andrzej Siewior
2022-02-04 14:11                 ` Jason A. Donenfeld
2022-02-04 14:30                   ` Sebastian Andrzej Siewior
2022-02-04 15:39                     ` Jason A. Donenfeld
2022-02-04 15:51                       ` [PATCH v3] " Jason A. Donenfeld
2022-02-04 15:57                         ` Sebastian Andrzej Siewior
2022-02-04 16:12                           ` Jason A. Donenfeld
2022-02-16 20:01                           ` Jann Horn
2022-02-16 20:58                             ` Jason A. Donenfeld
2022-02-17 17:33                               ` Sebastian Andrzej Siewior
2022-01-28 18:05     ` [PATCH] " Jonathan Neuschäfer
2022-01-29 18:22       ` Jason A. Donenfeld
2022-01-29  7:10     ` [random] 1e1724f9dd: UBSAN:array-index-out-of-bounds_in_drivers/char/random.c kernel test robot

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=YfQXgaAyBBEYSspV@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=Jason@zx2c4.com \
    --cc=boqun.feng@gmail.com \
    --cc=j.neuschaefer@gmx.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=tytso@mit.edu \
    --cc=will@kernel.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