Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-21 Thread Peter Zijlstra
On Tue, May 20, 2014 at 01:33:42PM +0400, Kirill Tkhai wrote: > [PATCH] sched/dl: Fix race in dl_task_timer() > > Throttled task is still on rq, and it may be moved to other cpu > if user is playing with sched_setaffinity(). Therefore, unlocked > task_rq() access makes the race. > > Juri Lelli re

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-20 Thread Kirill Tkhai
20.05.2014, 12:16, "Juri Lelli" : > Hi, > > On Tue, 20 May 2014 09:53:15 +0200 > Peter Zijlstra wrote: > >>  On Tue, May 20, 2014 at 09:08:53AM +0400, Kirill Tkhai wrote: >>>  20.05.2014, 04:00, "Peter Zijlstra" :  On Mon, May 19, 2014 at 11:31:19PM +0400, Kirill Tkhai wrote: >   @@ -513,

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-20 Thread Juri Lelli
Hi, On Tue, 20 May 2014 09:53:15 +0200 Peter Zijlstra wrote: > On Tue, May 20, 2014 at 09:08:53AM +0400, Kirill Tkhai wrote: > > > > > > 20.05.2014, 04:00, "Peter Zijlstra" : > > > On Mon, May 19, 2014 at 11:31:19PM +0400, Kirill Tkhai wrote: > > > > > >>  @@ -513,9 +513,17 @@ static enum hrti

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-20 Thread Peter Zijlstra
On Tue, May 20, 2014 at 09:08:53AM +0400, Kirill Tkhai wrote: > > > 20.05.2014, 04:00, "Peter Zijlstra" : > > On Mon, May 19, 2014 at 11:31:19PM +0400, Kirill Tkhai wrote: > > > >>  @@ -513,9 +513,17 @@ static enum hrtimer_restart dl_task_timer(struct > >> hrtimer *timer) > >>   

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-19 Thread Kirill Tkhai
20.05.2014, 09:08, "Kirill Tkhai" : > 20.05.2014, 04:00, "Peter Zijlstra" : > >>  On Mon, May 19, 2014 at 11:31:19PM +0400, Kirill Tkhai wrote: >>>   @@ -513,9 +513,17 @@ static enum hrtimer_restart dl_task_timer(struct >>> hrtimer *timer) >>>   

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-19 Thread Kirill Tkhai
20.05.2014, 04:00, "Peter Zijlstra" : > On Mon, May 19, 2014 at 11:31:19PM +0400, Kirill Tkhai wrote: > >>  @@ -513,9 +513,17 @@ static enum hrtimer_restart dl_task_timer(struct >> hrtimer *timer) >>    struct >> sched_dl_entity, >>   

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-19 Thread Peter Zijlstra
On Mon, May 19, 2014 at 11:31:19PM +0400, Kirill Tkhai wrote: > @@ -513,9 +513,17 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer > *timer) >struct sched_dl_entity, >dl_timer); >

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-19 Thread Kirill Tkhai
dl_timer); >>   struct task_struct *p = dl_task_of(dl_se); >>  - struct rq *rq = task_rq(p); >>  + struct rq *rq; > > We could maybe add a comment here, in line with what we have below, to > document why we need this. How about this? (I added

Re: [PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-19 Thread Juri Lelli
On Sat, 17 May 2014 01:30:03 +0400 Kirill Tkhai wrote: > The race is in unlocked task_rq() access. In pair with parallel > call of sched_setaffinity() it may be a reason of corruption > of internal rq's data. > Sure, the thing can happen! > Signed-off-by: Kirill Tkhai > CC: Juri Lelli > CC:

[PATCH] sched/dl: Fix race between dl_task_timer() and sched_setaffinity()

2014-05-16 Thread Kirill Tkhai
The race is in unlocked task_rq() access. In pair with parallel call of sched_setaffinity() it may be a reason of corruption of internal rq's data. Signed-off-by: Kirill Tkhai CC: Juri Lelli CC: Peter Zijlstra CC: Ingo Molnar Cc: # v3.14 --- kernel/sched/deadline.c |9 - 1 file c