Re: [PATCH] futex: avoid race between requeue and wake

2014-04-09 Thread Davidlohr Bueso
On Wed, 2014-04-09 at 08:12 -0700, Linus Torvalds wrote: > On Wed, Apr 9, 2014 at 4:46 AM, Jan Stancek wrote: > > > > > > I'm running reproducer with this patch applied on 3 systems: > > - two s390x systems where this can be reproduced within seconds > > - x86_64 Intel(R) Xeon(R) CPU E5240 @ 3.00G

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-09 Thread Linus Torvalds
On Wed, Apr 9, 2014 at 4:46 AM, Jan Stancek wrote: > > > I'm running reproducer with this patch applied on 3 systems: > - two s390x systems where this can be reproduced within seconds > - x86_64 Intel(R) Xeon(R) CPU E5240 @ 3.00GHz, where I could > reproduce it on average in ~3 minutes. > > It's

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-09 Thread Jan Stancek
Larry Woodman" > Sent: Wednesday, 9 April, 2014 12:30:07 AM > Subject: Re: [PATCH] futex: avoid race between requeue and wake > > On Tue, Apr 8, 2014 at 2:02 PM, Jan Stancek wrote: > > > > I ran reproducer with following change on s390x system, where this > &g

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Mike Galbraith
On Wed, 2014-04-09 at 07:41 +0200, Peter Zijlstra wrote: > On Tue, Apr 08, 2014 at 03:30:07PM -0700, Linus Torvalds wrote: > > So I'll have to leave this decision to the futex people. But the > > attached slightly more complex patch *may* be the better one. > > Of course, tglx is the main futex '

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Peter Zijlstra
On Tue, Apr 08, 2014 at 03:30:07PM -0700, Linus Torvalds wrote: > So I'll have to leave this decision to the futex people. But the > attached slightly more complex patch *may* be the better one. Of course, tglx is the main futex 'people' and he's not on CC.. *sigh*. -- To unsubscribe from this lis

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Davidlohr Bueso
Adding Thomas to the thread. Sorry for the late reply, I was out running errands all day just to get home to find this futex jewel in my inbox. On Tue, 2014-04-08 at 15:30 -0700, Linus Torvalds wrote: > On Tue, Apr 8, 2014 at 2:02 PM, Jan Stancek wrote: > > > > I ran reproducer with following ch

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Linus Torvalds
On Tue, Apr 8, 2014 at 2:02 PM, Jan Stancek wrote: > > I ran reproducer with following change on s390x system, where this > can be reproduced usually within seconds: > > diff --git a/kernel/futex.c b/kernel/futex.c > index 67dacaf..9150ffd 100644 > --- a/kernel/futex.c > +++ b/kernel/futex.c > @@

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Jan Stancek
ot;Larry Woodman" > Sent: Tuesday, 8 April, 2014 8:53:47 PM > Subject: Re: [PATCH] futex: avoid race between requeue and wake > > On Tue, Apr 8, 2014 at 11:13 AM, Peter Zijlstra wrote: > > On Tue, Apr 08, 2014 at 10:33:55AM -0700, Linus Torvalds wrote: > >> H

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Linus Torvalds
On Tue, Apr 8, 2014 at 11:13 AM, Peter Zijlstra wrote: > On Tue, Apr 08, 2014 at 10:33:55AM -0700, Linus Torvalds wrote: >> Hmm. And let's think about that powerpc race, where "spin_is_locked()" >> can be false when somebody is waiting to get the lock.. > > Right; so in the original discussion I n

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Peter Zijlstra
On Tue, Apr 08, 2014 at 10:33:55AM -0700, Linus Torvalds wrote: > Hmm. And let's think about that powerpc race, where "spin_is_locked()" > can be false when somebody is waiting to get the lock.. Right; so in the original discussion I never really got to why that is a problem. A pending waiter cann

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Jan Stancek
- Original Message - > From: "Linus Torvalds" > To: "Jan Stancek" > Cc: "Linux Kernel Mailing List" , "Srikar > Dronamraju" , > "Davidlohr Bueso" , "Ingo Molnar" , > "Larry Woodman" > Sent:

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Linus Torvalds
On Tue, Apr 8, 2014 at 9:20 AM, Linus Torvalds wrote: > > However, one exception to this is "requeue_futex()". Which is in fact > the test-case that Jan points to. There, when we move a futex from one > hash bucket to another, we do the increment inside the spinlock. > > So I think the change is c

Re: [PATCH] futex: avoid race between requeue and wake

2014-04-08 Thread Linus Torvalds
Davidlohr, comments? On Tue, Apr 8, 2014 at 1:47 AM, Jan Stancek wrote: > pthread_cond_broadcast/4-1.c testcase from openposix testsuite (LTP) > occasionally fails, because some threads fail to wake up. Jan, I _assume_ this is on x86(-64), but can you please confirm? Because if it's on anything