Re: "BUG: Invalid wait context" in invalidate_batched_entropy

From: Jason A. Donenfeld
Date: Fri Jan 28 2022 - 11:29:04 EST


Hi Sebastian,

On Fri, Jan 28, 2022 at 5:19 PM Sebastian Andrzej Siewior
<bigeasy@xxxxxxxxxxxxx> wrote:
> 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.

Gotcha. Surely, then, Andy's patch at least goes some of the way
toward fixing this, since it outright _removes_ a spinlock_t. There is
still the other spinlock_t that you want removed, I realize, though
this doesn't appear to be the one from Jonathan's bug report. It
sounds like Andy's patch might be one side of the fix, and your patch
the other?

Jason