[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87v94m2sre.ffs@tglx>
Date: Tue, 03 Aug 2021 22:11:17 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Mike Galbraith <efault@....de>,
LKML <linux-kernel@...r.kernel.org>,
Ingo Molnar <mingo@...nel.org>,
Juri Lelli <juri.lelli@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Daniel Bristot de Oliveira <bristot@...hat.com>,
Will Deacon <will@...nel.org>,
Waiman Long <longman@...hat.com>,
Boqun Feng <boqun.feng@...il.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Davidlohr Bueso <dave@...olabs.net>
Subject: Re: [patch 03/63] sched: Prepare for RT sleeping spin/rwlocks
On Tue, Aug 03 2021 at 16:51, Peter Zijlstra wrote:
> On Tue, Aug 03, 2021 at 04:04:07PM +0200, Thomas Gleixner wrote:
>> On Tue, Aug 03 2021 at 11:48, Peter Zijlstra wrote:
>>
>> > On Sun, Aug 01, 2021 at 05:30:06PM +0200, Mike Galbraith wrote:
>> >> On Fri, 2021-07-30 at 15:50 +0200, Thomas Gleixner wrote:
>> >> >
>> >> > --- a/include/linux/sched.h
>> >> > +++ b/include/linux/sched.h
>> >> > @@ -155,6 +155,27 @@ struct task_group;
>> >> > WRITE_ONCE(current->__state, (state_value)); \
>> >> > raw_spin_unlock_irqrestore(¤t->pi_lock, flags); \
>> >> > } while (0)
>> >> > +
>> >> > +
>> >> > +#define current_save_and_set_rtlock_wait_state() \
>> >> > + do { \
>> >> > + raw_spin_lock(¤t->pi_lock); \
>> >
>> > That wants to be irqsafe methinks, I realize this is PREEMPT_RT only and
>> > there the _irqfoo crap is a no-op so this doesn't really matter one way
>> > or the other, but still, taking PI lock without IRQ disable makes my
>> > head go BUG-BUG-BUG :-)
>>
>> Actually the rule to lock PI lock irqsave still persists on RT, but this
>> has to be called with interrupts disabled (rtmutex::wait_lock is held),
>> so adding a lockdep_assert_irqs_disable() might be good enough to spare
>> the extra save/restore. Hmm?
>
> Works for me.. and yes, duh, raw_.
And the lockdep_assert_irqs_disabled() is redundant as well because if
raw_spin_lock(¤t->pi_lock) is invoked with interrupts enabled
lockdep will yell too. But, yes it makes it more explicit.
Thanks,
tglx
Powered by blists - more mailing lists