Messages in this thread | | | Date | Tue, 3 Aug 2021 11:48:32 +0200 | From | Peter Zijlstra <> | Subject | Re: [patch 03/63] sched: Prepare for RT sleeping spin/rwlocks |
| |
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 :-)
> > + current->saved_state = current->__state; \ > ^^should that be using READ_ONCE()? >
I think we're good here, per this being 'current' and serialized against wakeup by virtue of holding pi_lock, __state is actually stable.
> > + current->saved_state_change = current->task_state_change;\ > > + current->task_state_change = _THIS_IP_; \ > > + WRITE_ONCE(current->__state, TASK_RTLOCK_WAIT); \ > > + raw_spin_unlock(¤t->pi_lock); \ > > + } while (0);
| |