[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230817082632.GA1006598@hirez.programming.kicks-ass.net>
Date: Thu, 17 Aug 2023 10:26:32 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: tglx@...utronix.de, linux-kernel@...r.kernel.org,
bsegall@...gle.com, boqun.feng@...il.com, swood@...hat.com,
bristot@...hat.com, dietmar.eggemann@....com, mingo@...hat.com,
jstultz@...gle.com, juri.lelli@...hat.com, mgorman@...e.de,
rostedt@...dmis.org, vschneid@...hat.com,
vincent.guittot@...aro.org, longman@...hat.com, will@...nel.org
Subject: Re: [PATCH 0/6] locking/rtmutex: Avoid PI state recursion through
sched_submit_work()
On Thu, Aug 17, 2023 at 08:59:50AM +0200, Sebastian Andrzej Siewior wrote:
> On 2023-08-16 16:58:18 [+0200], Peter Zijlstra wrote:
> > I've ended up with the below, but it is quite horrible.. but let me go
> > stare at the futex wreckage before trying to clean things up.
>
> What about
Ah, of course, that's much nicer. I got hung up on that
rwbase_rtmutex_lock_state() thing :/
> diff --git a/kernel/locking/rwbase_rt.c b/kernel/locking/rwbase_rt.c
> index f8a194e7ec9e9..b5e881250fec5 100644
> --- a/kernel/locking/rwbase_rt.c
> +++ b/kernel/locking/rwbase_rt.c
> @@ -241,6 +241,8 @@ static int __sched rwbase_write_lock(struct rwbase_rt *rwb,
> /* Force readers into slow path */
> atomic_sub(READER_BIAS, &rwb->readers);
>
> + rt_mutex_pre_schedule();
> +
> raw_spin_lock_irqsave(&rtm->wait_lock, flags);
> if (__rwbase_write_trylock(rwb))
> goto out_unlock;
> @@ -252,6 +254,7 @@ static int __sched rwbase_write_lock(struct rwbase_rt *rwb,
> if (rwbase_signal_pending_state(state, current)) {
> rwbase_restore_current_state();
> __rwbase_write_unlock(rwb, 0, flags);
> + rt_mutex_post_schedule();
> trace_contention_end(rwb, -EINTR);
> return -EINTR;
> }
> @@ -270,6 +273,7 @@ static int __sched rwbase_write_lock(struct rwbase_rt *rwb,
>
> out_unlock:
> raw_spin_unlock_irqrestore(&rtm->wait_lock, flags);
> + rt_mutex_post_schedule();
> return 0;
> }
>
> Sebastian
Powered by blists - more mailing lists