Re: [PATCH] pstore: Revert pmsg_lock back to a normal mutex

From: John Stultz
Date: Wed Mar 08 2023 - 15:04:40 EST


On Tue, Mar 7, 2023 at 5:31 PM Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Thu, 2 Mar 2023 20:01:36 -0500
> Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> > @@ -1421,11 +1425,23 @@ static bool rtmutex_spin_on_owner(struct rt_mutex_base *lock,
> > * for CONFIG_PREEMPT_RCU=y)
> > * - the VCPU on which owner runs is preempted
> > */
> > - if (!owner_on_cpu(owner) || need_resched() ||
> > - !rt_mutex_waiter_is_top_waiter(lock, waiter)) {
> > + if (!owner_on_cpu(owner) || need_resched()) {
> > res = false;
> > break;
> > }
> > + top_waiter = rt_mutex_top_waiter(lock);
>
> rt_mutex_top_waiter() can not be called outside the wait_lock, as it may
> trigger that BUG_ON() you saw.
>
> New patch below.

Hey Steven!
Thanks for the new version! It avoids the crash issue. However, with
my sef-created reproducer, I was still seeing similar regression going
between mutex to rtmutex.

I'm interested in continuing to see if we can further tweak it, but
I've got some other work I need to focus on, so I think I'm going to
advocate for the revert in the short-term and look at finer grained
locking (along with rtmutex to address the priority inversion issue)
in the longer term.

thanks
-john