From mboxrd@z Thu Jan 1 00:00:00 1970 From: Darren Hart Subject: Re: futex(2) man page update help request Date: Fri, 16 Jan 2015 16:46:39 -0800 Message-ID: References: <537346E5.4050407@gmail.com> <5373D0CA.2050204@redhat.com> <54B7D87C.3090901@gmail.com> <54B92B71.2090509@gmail.com> <54B97A72.2050205@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <54B97A72.2050205-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> Sender: linux-api-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: "Michael Kerrisk (man-pages)" , Thomas Gleixner Cc: Carlos O'Donell , Ingo Molnar , Jakub Jelinek , "linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , lkml , Davidlohr Bueso , Arnd Bergmann , Steven Rostedt , Peter Zijlstra , Linux API , Torvald Riegel , Roland McGrath , Darren Hart , Anton Blanchard , Petr Baudis , Eric Dumazet , bill o gallmeister , Jan Kiszka , Daniel Wagner , Rich Felker List-Id: linux-man@vger.kernel.org On 1/16/15, 12:54 PM, "Michael Kerrisk (man-pages)" wrote: >On 01/16/2015 04:20 PM, Thomas Gleixner wrote: >> On Fri, 16 Jan 2015, Michael Kerrisk (man-pages) wrote: >> >>> Hello Thomas, >>> >>> On 01/15/2015 11:23 PM, Thomas Gleixner wrote: >>>> On Thu, 15 Jan 2015, Michael Kerrisk (man-pages) wrote: >>>>>> [EINVAL] uaddr equal uaddr2. Requeue to same futex. >>>>> >>>>> ??? I added this, but does this error not occur only for PI requeues? >>>> >>>> It's equally wrong for normal futexes. And its actually the same code >>>> checking for this for all variants. >>> >>> I don't understand "equally wrong" in your reply, I'm sorry. Do you >>> mean: >>> >>> a) This error text should be there for both normal and PI requeues >> >> It is there for both. The requeue code has that check independent of >> the requeue type (normal/pi). It never makes sense to requeue >> something to itself whether normal or pi futex. We added this for PI, >> because there it is harmful, but we did not special case it. So normal >> futexes get the same treatment. > >Hello Thomas, > >Color me stupid, but I can't see this in futex_requeue(). Where is that >check that is "independent of the requeue type (normal/pi)"? > >When I look through futex_requeue(), all the likely looking sources >of EINVAL are governed by a check on the 'requeue_pi' argument. Right, in the non-PI case, I believe there are valid use cases: move to the back of the FIFO, for example (OK, maybe the only example?). Both tests ensuring uaddr1 != uaddr2 are under the requeue_pi conditional block. The second compares the keys in case they are not FUTEX_PRIVATE (uaddrs would be different, but still the same backing store). Thomas, am I missing a test for this someplace else? -- Darren Hart Intel Open Source Technology Center