Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-12 Thread Xunlei Pang
On 2016/04/12 at 23:51, Peter Zijlstra wrote: > On Tue, Apr 12, 2016 at 11:08:04AM +0800, Xunlei Pang wrote: >> I spotted another issue, we access pi_task without any lock in >> enqueue_task_dl(), > OK, so I'm on the road and entirely jetlagged, but how can > enqueue_task_dl() not have rq->lock

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-12 Thread Xunlei Pang
On 2016/04/12 at 23:51, Peter Zijlstra wrote: > On Tue, Apr 12, 2016 at 11:08:04AM +0800, Xunlei Pang wrote: >> I spotted another issue, we access pi_task without any lock in >> enqueue_task_dl(), > OK, so I'm on the road and entirely jetlagged, but how can > enqueue_task_dl() not have rq->lock

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-12 Thread Peter Zijlstra
On Tue, Apr 12, 2016 at 11:08:04AM +0800, Xunlei Pang wrote: > I spotted another issue, we access pi_task without any lock in > enqueue_task_dl(), OK, so I'm on the road and entirely jetlagged, but how can enqueue_task_dl() not have rq->lock held?

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-12 Thread Peter Zijlstra
On Tue, Apr 12, 2016 at 11:08:04AM +0800, Xunlei Pang wrote: > I spotted another issue, we access pi_task without any lock in > enqueue_task_dl(), OK, so I'm on the road and entirely jetlagged, but how can enqueue_task_dl() not have rq->lock held?

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-11 Thread Xunlei Pang
On 2016/04/10 at 16:22, Xunlei Pang wrote: > On 2016/04/09 at 21:29, Peter Zijlstra wrote: >> On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: >> In any case, I just realized we do not in fact provide this guarantee (of pointing to a blocked task) that needs a bit more work.

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-11 Thread Xunlei Pang
On 2016/04/10 at 16:22, Xunlei Pang wrote: > On 2016/04/09 at 21:29, Peter Zijlstra wrote: >> On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: >> In any case, I just realized we do not in fact provide this guarantee (of pointing to a blocked task) that needs a bit more work.

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-10 Thread Xunlei Pang
On 2016/04/09 at 21:29, Peter Zijlstra wrote: > On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: > >>> In any case, I just realized we do not in fact provide this guarantee >>> (of pointing to a blocked task) that needs a bit more work. >> Current patch calls rt_mutex_adjust_prio()

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-10 Thread Xunlei Pang
On 2016/04/09 at 21:29, Peter Zijlstra wrote: > On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: > >>> In any case, I just realized we do not in fact provide this guarantee >>> (of pointing to a blocked task) that needs a bit more work. >> Current patch calls rt_mutex_adjust_prio()

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-09 Thread Peter Zijlstra
On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: > > In any case, I just realized we do not in fact provide this guarantee > > (of pointing to a blocked task) that needs a bit more work. > > Current patch calls rt_mutex_adjust_prio() before wake_up_q() the > wakee, at that moment the

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-09 Thread Peter Zijlstra
On Sat, Apr 09, 2016 at 11:25:39AM +0800, Xunlei Pang wrote: > > In any case, I just realized we do not in fact provide this guarantee > > (of pointing to a blocked task) that needs a bit more work. > > Current patch calls rt_mutex_adjust_prio() before wake_up_q() the > wakee, at that moment the

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Xunlei Pang
On 2016/04/09 at 03:28, Steven Rostedt wrote: > On Fri, 8 Apr 2016 15:15:42 -0400 > Steven Rostedt wrote: > >> From what I understand, the slowfn() modifies the task pi_list (or >> rbtree, as it is today). As this is an unlock, the task being woken >> (the next one to grab

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Xunlei Pang
On 2016/04/09 at 03:28, Steven Rostedt wrote: > On Fri, 8 Apr 2016 15:15:42 -0400 > Steven Rostedt wrote: > >> From what I understand, the slowfn() modifies the task pi_list (or >> rbtree, as it is today). As this is an unlock, the task being woken >> (the next one to grab the lock) is removed

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Xunlei Pang
On 2016/04/09 at 02:59, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 02:50:55PM -0400, Steven Rostedt wrote: >> On Fri, 8 Apr 2016 19:38:35 +0200 >> Peter Zijlstra wrote: >> >>> On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: >>> So the

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Xunlei Pang
On 2016/04/09 at 02:59, Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 02:50:55PM -0400, Steven Rostedt wrote: >> On Fri, 8 Apr 2016 19:38:35 +0200 >> Peter Zijlstra wrote: >> >>> On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: >>> So the preempt_disable() is to allow us to

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Fri, 8 Apr 2016 15:15:42 -0400 Steven Rostedt wrote: > From what I understand, the slowfn() modifies the task pi_list (or > rbtree, as it is today). As this is an unlock, the task being woken > (the next one to grab the lock) is removed from the previous task's pi > list.

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Fri, 8 Apr 2016 15:15:42 -0400 Steven Rostedt wrote: > From what I understand, the slowfn() modifies the task pi_list (or > rbtree, as it is today). As this is an unlock, the task being woken > (the next one to grab the lock) is removed from the previous task's pi > list. > > In

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Fri, 8 Apr 2016 20:59:16 +0200 Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 02:50:55PM -0400, Steven Rostedt wrote: > > On Fri, 8 Apr 2016 19:38:35 +0200 > > Peter Zijlstra wrote: > > > > > On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Fri, 8 Apr 2016 20:59:16 +0200 Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 02:50:55PM -0400, Steven Rostedt wrote: > > On Fri, 8 Apr 2016 19:38:35 +0200 > > Peter Zijlstra wrote: > > > > > On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > > > > > > > So the

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 02:50:55PM -0400, Steven Rostedt wrote: > On Fri, 8 Apr 2016 19:38:35 +0200 > Peter Zijlstra wrote: > > > On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > > > > > So the preempt_disable() is to allow us to set current back to its >

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 02:50:55PM -0400, Steven Rostedt wrote: > On Fri, 8 Apr 2016 19:38:35 +0200 > Peter Zijlstra wrote: > > > On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > > > > > So the preempt_disable() is to allow us to set current back to its > > > normal priority

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Fri, 8 Apr 2016 19:38:35 +0200 Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > > > So the preempt_disable() is to allow us to set current back to its > > normal priority first before waking up the other task because we don't > >

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Fri, 8 Apr 2016 19:38:35 +0200 Peter Zijlstra wrote: > On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > > > So the preempt_disable() is to allow us to set current back to its > > normal priority first before waking up the other task because we don't > > want two tasks at the

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > So the preempt_disable() is to allow us to set current back to its > normal priority first before waking up the other task because we don't > want two tasks at the same priority? > What's the point of swapping deboost and the wake

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Peter Zijlstra
On Fri, Apr 08, 2016 at 12:25:10PM -0400, Steven Rostedt wrote: > So the preempt_disable() is to allow us to set current back to its > normal priority first before waking up the other task because we don't > want two tasks at the same priority? > What's the point of swapping deboost and the wake

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Tue, 5 Apr 2016 11:29:54 +0200 Peter Zijlstra wrote: > -- > kernel/locking/rtmutex.c | 16 +--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c > index 3e746607abe5..1896baf28e9c

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-08 Thread Steven Rostedt
On Tue, 5 Apr 2016 11:29:54 +0200 Peter Zijlstra wrote: > -- > kernel/locking/rtmutex.c | 16 +--- > 1 file changed, 13 insertions(+), 3 deletions(-) > > diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c > index 3e746607abe5..1896baf28e9c 100644 > ---

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 06:48:38PM +0800, Xunlei Pang wrote: > This is cool, I think we should also init "pi_task" properly for INIT_MUTEX > and fork, > otherwise looks good to me :-) Indeed.. > Besides, do you think we can kill "pi_waiters_leftmost" from task_struct, as > we > can easily get

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 06:48:38PM +0800, Xunlei Pang wrote: > This is cool, I think we should also init "pi_task" properly for INIT_MUTEX > and fork, > otherwise looks good to me :-) Indeed.. > Besides, do you think we can kill "pi_waiters_leftmost" from task_struct, as > we > can easily get

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Xunlei Pang
On 2016/04/05 at 17:29, Peter Zijlstra wrote: > On Tue, Apr 05, 2016 at 11:19:54AM +0200, Peter Zijlstra wrote: >> Or did I miss something (again) ? :-) >> >> --- >> kernel/locking/rtmutex.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/locking/rtmutex.c

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Xunlei Pang
On 2016/04/05 at 17:29, Peter Zijlstra wrote: > On Tue, Apr 05, 2016 at 11:19:54AM +0200, Peter Zijlstra wrote: >> Or did I miss something (again) ? :-) >> >> --- >> kernel/locking/rtmutex.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/kernel/locking/rtmutex.c

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 11:19:54AM +0200, Peter Zijlstra wrote: > Or did I miss something (again) ? :-) > > --- > kernel/locking/rtmutex.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c > index

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 11:19:54AM +0200, Peter Zijlstra wrote: > Or did I miss something (again) ? :-) > > --- > kernel/locking/rtmutex.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c > index

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 04:38:12PM +0800, Xunlei Pang wrote: > On 2016/04/02 at 05:51, Peter Zijlstra wrote: > > On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > > > I checked the code, currently only deadline accesses the > pi_waiters/pi_waiters_leftmost > without

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Peter Zijlstra
On Tue, Apr 05, 2016 at 04:38:12PM +0800, Xunlei Pang wrote: > On 2016/04/02 at 05:51, Peter Zijlstra wrote: > > On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > > > I checked the code, currently only deadline accesses the > pi_waiters/pi_waiters_leftmost > without

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Xunlei Pang
On 2016/04/02 at 05:51, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > I checked the code, currently only deadline accesses the pi_waiters/pi_waiters_leftmost without pi_lock held via rt_mutex_get_top_task(), other cases all have pi_lock

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-05 Thread Xunlei Pang
On 2016/04/02 at 05:51, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > I checked the code, currently only deadline accesses the pi_waiters/pi_waiters_leftmost without pi_lock held via rt_mutex_get_top_task(), other cases all have pi_lock

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-02 Thread Xunlei Pang
On 2016/04/02 at 05:51, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > I checked the code, currently only deadline accesses the pi_waiters/pi_waiters_leftmost without pi_lock held via rt_mutex_get_top_task(), other cases all have pi_lock

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-02 Thread Xunlei Pang
On 2016/04/02 at 05:51, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > I checked the code, currently only deadline accesses the pi_waiters/pi_waiters_leftmost without pi_lock held via rt_mutex_get_top_task(), other cases all have pi_lock

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Peter Zijlstra
On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > >> I checked the code, currently only deadline accesses the > >> pi_waiters/pi_waiters_leftmost > >> without pi_lock held via rt_mutex_get_top_task(), other cases all have > >> pi_lock held. > Any better ideas is welcome. Something

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Peter Zijlstra
On Fri, Apr 01, 2016 at 09:34:24PM +0800, Xunlei Pang wrote: > >> I checked the code, currently only deadline accesses the > >> pi_waiters/pi_waiters_leftmost > >> without pi_lock held via rt_mutex_get_top_task(), other cases all have > >> pi_lock held. > Any better ideas is welcome. Something

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Xunlei Pang
On 2016/04/01 at 21:12, Peter Zijlstra wrote: > > On 1 April 2016 14:23:58 CEST, Xunlei Pang wrote: > We need this iff lock owner has the deadline priority. >>> How is this deadline specific, those functions you modify are >>> deadline/rt agnostic. >> I checked the code,

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Xunlei Pang
On 2016/04/01 at 21:12, Peter Zijlstra wrote: > > On 1 April 2016 14:23:58 CEST, Xunlei Pang wrote: > We need this iff lock owner has the deadline priority. >>> How is this deadline specific, those functions you modify are >>> deadline/rt agnostic. >> I checked the code, currently only

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Peter Zijlstra
On 1 April 2016 14:23:58 CEST, Xunlei Pang wrote: >>> We need this iff lock owner has the deadline priority. >> How is this deadline specific, those functions you modify are >> deadline/rt agnostic. > >I checked the code, currently only deadline accesses the

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Peter Zijlstra
On 1 April 2016 14:23:58 CEST, Xunlei Pang wrote: >>> We need this iff lock owner has the deadline priority. >> How is this deadline specific, those functions you modify are >> deadline/rt agnostic. > >I checked the code, currently only deadline accesses the >pi_waiters/pi_waiters_leftmost

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Xunlei Pang
On 2016/04/01 at 19:38, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 07:00:18PM +0800, Xunlei Pang wrote: >> I found a kernel crash while playing with deadline PI rtmutex. >> >> BUG: unable to handle kernel NULL pointer dereference at 0018 >> IP: []

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Xunlei Pang
On 2016/04/01 at 19:38, Peter Zijlstra wrote: > On Fri, Apr 01, 2016 at 07:00:18PM +0800, Xunlei Pang wrote: >> I found a kernel crash while playing with deadline PI rtmutex. >> >> BUG: unable to handle kernel NULL pointer dereference at 0018 >> IP: []

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Peter Zijlstra
On Fri, Apr 01, 2016 at 07:00:18PM +0800, Xunlei Pang wrote: > I found a kernel crash while playing with deadline PI rtmutex. > > BUG: unable to handle kernel NULL pointer dereference at 0018 > IP: [] rt_mutex_get_top_task+0x1f/0x30 > PGD 232a75067 PUD 230947067 PMD 0 >

Re: [PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Peter Zijlstra
On Fri, Apr 01, 2016 at 07:00:18PM +0800, Xunlei Pang wrote: > I found a kernel crash while playing with deadline PI rtmutex. > > BUG: unable to handle kernel NULL pointer dereference at 0018 > IP: [] rt_mutex_get_top_task+0x1f/0x30 > PGD 232a75067 PUD 230947067 PMD 0 >

[PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Xunlei Pang
I found a kernel crash while playing with deadline PI rtmutex. BUG: unable to handle kernel NULL pointer dereference at 0018 IP: [] rt_mutex_get_top_task+0x1f/0x30 PGD 232a75067 PUD 230947067 PMD 0 Oops: [#1] SMP CPU: 1 PID: 10994 Comm: a.out Not tainted

[PATCH] sched/deadline/rtmutex: Fix a PI crash for deadline tasks

2016-04-01 Thread Xunlei Pang
I found a kernel crash while playing with deadline PI rtmutex. BUG: unable to handle kernel NULL pointer dereference at 0018 IP: [] rt_mutex_get_top_task+0x1f/0x30 PGD 232a75067 PUD 230947067 PMD 0 Oops: [#1] SMP CPU: 1 PID: 10994 Comm: a.out Not tainted