[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180403133543.GA26653@andrea>
Date: Tue, 3 Apr 2018 15:35:43 +0200
From: Andrea Parri <andrea.parri@...rulasolutions.com>
To: David Howells <dhowells@...hat.com>
Cc: 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>,
Alan Stern <stern@...land.harvard.edu>,
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 Tue, Apr 03, 2018 at 01:49:09PM +0100, David Howells wrote:
> Andrea Parri <andrea.parri@...rulasolutions.com> wrote:
>
> > +/**
> > + * spin_is_locked() - Check whether a spinlock is locked.
> > + * @lock: Pointer to the spinlock.
> > + *
> > + * This function is NOT required to provide any memory ordering
> > + * guarantees; it could be used for debugging purposes or, when
> > + * additional synchronization is needed, accompanied with other
> > + * constructs (memory barriers) enforcing the synchronization.
> > + *
> > + * Return: 1, if @lock is (found to be) locked; 0, otherwise.
>
> It's more complicated than that. This function is dangerous and should be
> used with extreme care. In the case where CONFIG_SMP=n the value is locked
> one way or the other and it might be the wrong way.
You mean "unlocked"? (aka, return 0)
Andrea
>
> David
Powered by blists - more mailing lists