From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753216AbbJGJe0 (ORCPT ); Wed, 7 Oct 2015 05:34:26 -0400 Received: from mail-wi0-f176.google.com ([209.85.212.176]:35707 "EHLO mail-wi0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752693AbbJGJeX (ORCPT ); Wed, 7 Oct 2015 05:34:23 -0400 Message-ID: <5614E71B.3040500@gmail.com> Date: Wed, 07 Oct 2015 10:34:19 +0100 From: "Michael Kerrisk (man-pages)" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Thomas Gleixner , Darren Hart CC: mtk.manpages@gmail.com, Torvald Riegel , "Carlos O'Donell" , Ingo Molnar , Jakub Jelinek , linux-man , lkml , Davidlohr Bueso , Arnd Bergmann , Steven Rostedt , Peter Zijlstra , Linux API , Roland McGrath , Anton Blanchard , Eric Dumazet , bill o gallmeister , Jan Kiszka , Daniel Wagner , Rich Felker , Andy Lutomirski , bert hubert , Rusty Russell , Heinrich Schuchardt Subject: Re: Next round: revised futex(2) man page for review References: <55B61EF3.7080302@gmail.com> <20150805222140.GA74817@vmdeb7> In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/19/2015 03:40 PM, Thomas Gleixner wrote: > On Wed, 5 Aug 2015, Darren Hart wrote: >> On Mon, Jul 27, 2015 at 02:07:15PM +0200, Michael Kerrisk (man-pages) wrote: >>> .\" FIXME XXX ===== Start of adapted Hart/Guniguntala text ===== >>> .\" The following text is drawn from the Hart/Guniguntala paper >>> .\" (listed in SEE ALSO), but I have reworded some pieces >>> .\" significantly. Please check it. >>> >>> The PI futex operations described below differ from the other >>> futex operations in that they impose policy on the use of the >>> value of the futex word: >>> >>> * If the lock is not acquired, the futex word's value shall be >>> 0. >>> >>> * If the lock is acquired, the futex word's value shall be the >>> thread ID (TID; see gettid(2)) of the owning thread. >>> >>> * If the lock is owned and there are threads contending for the >>> lock, then the FUTEX_WAITERS bit shall be set in the futex >>> word's value; in other words, this value is: >>> >>> FUTEX_WAITERS | TID >>> >>> >>> Note that a PI futex word never just has the value FUTEX_WAITERS, >>> which is a permissible state for non-PI futexes. >> >> The second clause is inappropriate. I don't know if that was yours or >> mine, but non-PI futexes do not have a kernel defined value policy, so >> ==FUTEX_WAITERS cannot be a "permissible state" as any value is >> permissible for non-PI futexes, and none have a kernel defined state. > > Depends. If the regular futex is configured as robust, then we have a > kernel defined value policy as well. Okay -- so do we need a change to the text here? >>> .\" FIXME I'm not quite clear on the meaning of the following sentence. >>> .\" Is this trying to say that while blocked in a >>> .\" FUTEX_WAIT_REQUEUE_PI, it could happen that another >>> .\" task does a FUTEX_WAKE on uaddr that simply causes >>> .\" a normal wake, with the result that the FUTEX_WAIT_REQUEUE_PI >>> .\" does not complete? What happens then to the FUTEX_WAIT_REQUEUE_PI >>> .\" opertion? Does it remain blocked, or does it unblock >>> .\" In which case, what does user space see? >>> >>> The >>> waiter can be removed from the wait on uaddr via >>> FUTEX_WAKE without requeueing on uaddr2. >> >> Userspace should see the task wake and continue executing. This would >> effectively be a cancelation operation - which I didn't think was >> supported. Thomas? > > We probably never intended to support it, but looking at the code it > works (did not try it though). It returns to user space with > -EWOULDBLOCK. So it basically behaves like any other spurious wakeup. Again, I assume no changes are required to the man page(?). Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/