[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <91b57513-99be-7b77-ebe2-a7c2a121475f@infradead.org>
Date: Tue, 3 Apr 2018 14:47:49 -0700
From: Randy Dunlap <rdunlap@...radead.org>
To: David Howells <dhowells@...hat.com>,
Alan Stern <stern@...land.harvard.edu>
Cc: Andrea Parri <andrea.parri@...rulasolutions.com>,
paulmck@...ux.vnet.ibm.com, Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
linux-kernel@...r.kernel.org,
Andrea Parri <parri.andrea@...il.com>,
Will Deacon <will.deacon@....com>,
Boqun Feng <boqun.feng@...il.com>,
Nicholas Piggin <npiggin@...il.com>,
Jade Alglave <j.alglave@....ac.uk>,
Luc Maranget <luc.maranget@...ia.fr>,
Akira Yokosawa <akiyks@...il.com>
Subject: Re: [PATCH v2 1/3] locking: Document the semantics of
spin_is_locked()
On 04/03/2018 02:43 PM, David Howells wrote:
> Alan Stern <stern@...land.harvard.edu> wrote:
>
>> + * Returns: 1 if @lock is locked, 0 otherwise.
>> + * However, on !CONFIG_SMP builds with !CONFIG_DEBUG_SPINLOCK,
>> + * the return value is always 0 (see include/linux/spinlock_up.h).
>> + * Therefore you should not rely heavily on the return value.
>
> Seems reasonable.
>
> It might also want to include a note that the lock isn't necessarily held by
> your own CPU. I would also use "=n" rather than "!", so maybe something like:
>
> * Returns: 1 if @lock is locked, 0 otherwise.
> *
> * Note that the function only tells you that the CPU is seen to be locked,
the CPU is locked??
> * not that it is locked on your CPU.
> *
> * Further, on CONFIG_SMP=n builds with CONFIG_DEBUG_SPINLOCK=n, the return
> * value is always 0 (see include/linux/spinlock_up.h). Therefore you should
> * not rely heavily on the return value.
>
> David
>
--
~Randy
Powered by blists - more mailing lists