Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1422131 > unrolled thread

Re: [RFC][PATCH 8/8] rtmutex: Fix PI chain order integrity

Started byJuri Lelli <juri.lelli@arm.com>
First post2016-06-14 19:40 +0200
Last post2016-06-15 09:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC][PATCH 8/8] rtmutex: Fix PI chain order integrity Juri Lelli <juri.lelli@arm.com> - 2016-06-14 19:40 +0200
    Re: [RFC][PATCH 8/8] rtmutex: Fix PI chain order integrity Peter Zijlstra <peterz@infradead.org> - 2016-06-14 21:50 +0200
      Re: [RFC][PATCH 8/8] rtmutex: Fix PI chain order integrity Juri Lelli <juri.lelli@arm.com> - 2016-06-15 09:30 +0200

#1422131 — Re: [RFC][PATCH 8/8] rtmutex: Fix PI chain order integrity

FromJuri Lelli <juri.lelli@arm.com>
Date2016-06-14 19:40 +0200
SubjectRe: [RFC][PATCH 8/8] rtmutex: Fix PI chain order integrity
Message-ID<rK0tH-7VX-5@gated-at.bofh.it>
On 07/06/16 21:56, Peter Zijlstra wrote:
> rt_mutex_waiter::prio is a copy of task_struct::prio which is updated
> during the PI chain walk, such that the PI chain order isn't messed up
> by (asynchronous) task state updates.
> 
> Currently rt_mutex_waiter_less() uses task state for deadline tasks;
> this is broken, since the task state can, as said above, change
> asynchronously, causing the RB tree order to change without actual
> tree update -> FAIL.
> 
> Fix this by also copying the deadline into the rt_mutex_waiter state
> and updating it along with its prio field.
> 
> Ideally we would also force PI chain updates whenever DL tasks update
> their deadline parameter, but for first approximation this is less
> broken than it was.
> 

The patch looks OK to me. However, I'm failing to see when we can update
dl.deadline of a waiter asynchronously. Since a waiter is blocked, we
can't really change his dl.deadline by calling setscheduler on him, as
the update would operate on dl.dl_deadline. The new values will start to
be used as soon as it gets unblocked. The situation seems different for
RT tasks, for which priority change takes effect immediately.

What am I missing? :-)

[toc] | [next] | [standalone]


#1422259

FromPeter Zijlstra <peterz@infradead.org>
Date2016-06-14 21:50 +0200
Message-ID<rK2vv-NN-11@gated-at.bofh.it>
In reply to#1422131
On Tue, Jun 14, 2016 at 06:39:08PM +0100, Juri Lelli wrote:
> On 07/06/16 21:56, Peter Zijlstra wrote:
> > rt_mutex_waiter::prio is a copy of task_struct::prio which is updated
> > during the PI chain walk, such that the PI chain order isn't messed up
> > by (asynchronous) task state updates.
> > 
> > Currently rt_mutex_waiter_less() uses task state for deadline tasks;
> > this is broken, since the task state can, as said above, change
> > asynchronously, causing the RB tree order to change without actual
> > tree update -> FAIL.
> > 
> > Fix this by also copying the deadline into the rt_mutex_waiter state
> > and updating it along with its prio field.
> > 
> > Ideally we would also force PI chain updates whenever DL tasks update
> > their deadline parameter, but for first approximation this is less
> > broken than it was.
> > 
> 
> The patch looks OK to me. However, I'm failing to see when we can update
> dl.deadline of a waiter asynchronously. Since a waiter is blocked, we
> can't really change his dl.deadline by calling setscheduler on him, as
> the update would operate on dl.dl_deadline. The new values will start to
> be used as soon as it gets unblocked. The situation seems different for
> RT tasks, for which priority change takes effect immediately.
> 
> What am I missing? :-)

Ah, I missed the dl_deadline vs deadline thing. Still, with optimistic
spinning the waiter could hit its throttle/refresh path, right? And then
that would update deadline.

[toc] | [prev] | [next] | [standalone]


#1422686

FromJuri Lelli <juri.lelli@arm.com>
Date2016-06-15 09:30 +0200
Message-ID<rKdqV-7W8-5@gated-at.bofh.it>
In reply to#1422259
On 14/06/16 21:44, Peter Zijlstra wrote:
> On Tue, Jun 14, 2016 at 06:39:08PM +0100, Juri Lelli wrote:
> > On 07/06/16 21:56, Peter Zijlstra wrote:
> > > rt_mutex_waiter::prio is a copy of task_struct::prio which is updated
> > > during the PI chain walk, such that the PI chain order isn't messed up
> > > by (asynchronous) task state updates.
> > > 
> > > Currently rt_mutex_waiter_less() uses task state for deadline tasks;
> > > this is broken, since the task state can, as said above, change
> > > asynchronously, causing the RB tree order to change without actual
> > > tree update -> FAIL.
> > > 
> > > Fix this by also copying the deadline into the rt_mutex_waiter state
> > > and updating it along with its prio field.
> > > 
> > > Ideally we would also force PI chain updates whenever DL tasks update
> > > their deadline parameter, but for first approximation this is less
> > > broken than it was.
> > > 
> > 
> > The patch looks OK to me. However, I'm failing to see when we can update
> > dl.deadline of a waiter asynchronously. Since a waiter is blocked, we
> > can't really change his dl.deadline by calling setscheduler on him, as
> > the update would operate on dl.dl_deadline. The new values will start to
> > be used as soon as it gets unblocked. The situation seems different for
> > RT tasks, for which priority change takes effect immediately.
> > 
> > What am I missing? :-)
> 
> Ah, I missed the dl_deadline vs deadline thing. Still, with optimistic
> spinning the waiter could hit its throttle/refresh path, right? And then
> that would update deadline.
> 

I guess it's not that likely, but yes it could potentially happen that a
waiter is optimistically spinning, depletes its runtime, gets throttled
and then replenished when still spinning. Maybe it doesn't really make
sense continuing spinning in this situation, but I guess things get
really complicated. :-/

Anyway, as said, I think this patch is OK. Maybe we want to add a
comment just to remember what situation can cause an issue if we don't
do this? Patch changelog would be OK as well for such a comment IMHO.

Thanks,

- Juri

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web