Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-08 Thread Peter Zijlstra
On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: > > �.../... > > > > Cc: Peter Zijlstra > > Cc: Nicholas Piggin > > Acked-by: Benjamin Herrenschmidt

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-08 Thread Peter Zijlstra
On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: > > �.../... > > > > Cc: Peter Zijlstra > > Cc: Nicholas Piggin > > Acked-by: Benjamin Herrenschmidt > > > Signed-off-by: Balbir Singh > > --- > >

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Balbir Singh
On Mon, Sep 5, 2016 at 5:48 PM, Peter Zijlstra wrote: > On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: >> On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: >> >> .../... >> > >> > Cc: Peter Zijlstra >> > Cc: Nicholas

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Balbir Singh
On Mon, Sep 5, 2016 at 5:48 PM, Peter Zijlstra wrote: > On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: >> On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: >> >> .../... >> > >> > Cc: Peter Zijlstra >> > Cc: Nicholas Piggin >> >> Acked-by: Benjamin Herrenschmidt

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Benjamin Herrenschmidt
On Mon, 2016-09-05 at 10:24 +0200, Mike Galbraith wrote: > > > Acked-by: Benjamin Herrenschmidt > > >  > > > > Signed-off-by: Balbir Singh > > > > --- > > ... no Cc: @stable?  Sounds plenty nasty enough to be worthy. Right, we should have it in

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Benjamin Herrenschmidt
On Mon, 2016-09-05 at 10:24 +0200, Mike Galbraith wrote: > > > Acked-by: Benjamin Herrenschmidt > > >  > > > > Signed-off-by: Balbir Singh > > > > --- > > ... no Cc: @stable?  Sounds plenty nasty enough to be worthy. Right, we should have it in stable too. Peter, can you still stick that in ?

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Mike Galbraith
On Mon, 2016-09-05 at 09:48 +0200, Peter Zijlstra wrote: > On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: > > On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: > > > > .../... > > > > > > Cc: Peter Zijlstra > > > Cc: Nicholas Piggin

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Mike Galbraith
On Mon, 2016-09-05 at 09:48 +0200, Peter Zijlstra wrote: > On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: > > On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: > > > > .../... > > > > > > Cc: Peter Zijlstra > > > Cc: Nicholas Piggin > > > > Acked-by: Benjamin

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Peter Zijlstra
On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: > >  .../... > > > > Cc: Peter Zijlstra > > Cc: Nicholas Piggin > > Acked-by: Benjamin Herrenschmidt

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Peter Zijlstra
On Mon, Sep 05, 2016 at 05:14:19PM +1000, Benjamin Herrenschmidt wrote: > On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote: > >  .../... > > > > Cc: Peter Zijlstra > > Cc: Nicholas Piggin > > Acked-by: Benjamin Herrenschmidt > > > Signed-off-by: Balbir Singh > > --- > >  

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Benjamin Herrenschmidt
On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote:  .../... > > Cc: Peter Zijlstra > Cc: Nicholas Piggin Acked-by: Benjamin Herrenschmidt > Signed-off-by: Balbir Singh > --- >  kernel/sched/core.c

Re: [RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-05 Thread Benjamin Herrenschmidt
On Mon, 2016-09-05 at 13:16 +1000, Balbir Singh wrote:  .../... > > Cc: Peter Zijlstra > Cc: Nicholas Piggin Acked-by: Benjamin Herrenschmidt > Signed-off-by: Balbir Singh > --- >  kernel/sched/core.c | 11 +++ >  1 file changed, 11 insertions(+) > > diff --git

[RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-04 Thread Balbir Singh
The origin of the issue I've seen is related to a missing memory barrier between check for task->state and the check for task->on_rq. The task being woken up is already awake from a schedule() and is doing the following do { schedule() set_current_state(TASK_(UN)INTERRUPTIBLE);

[RESEND][v2][PATCH] Fix a race between try_to_wake_up() and a woken up task

2016-09-04 Thread Balbir Singh
The origin of the issue I've seen is related to a missing memory barrier between check for task->state and the check for task->on_rq. The task being woken up is already awake from a schedule() and is doing the following do { schedule() set_current_state(TASK_(UN)INTERRUPTIBLE);