From: Andi Kleen <ak@suse.de>
To: Nick Piggin <npiggin@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@elte.hu>,
linux-arch@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch 2/2] x86_64: ticket lock spinlock
Date: Thu, 9 Aug 2007 11:54:34 +0200 [thread overview]
Message-ID: <200708091154.34581.ak@suse.de> (raw)
In-Reply-To: <20070809014254.GB12539@wotan.suse.de>
On Thursday 09 August 2007 03:42:54 Nick Piggin wrote:
> On Wed, Aug 08, 2007 at 12:26:55PM +0200, Andi Kleen wrote:
> >
> > > *
> > > * (the type definitions are in asm/spinlock_types.h)
> > > */
> > >
> > > +#if (NR_CPUS > 256)
> > > +#error spinlock supports a maximum of 256 CPUs
> > > +#endif
> > > +
> > > static inline int __raw_spin_is_locked(raw_spinlock_t *lock)
> > > {
> > > - return *(volatile signed int *)(&(lock)->slock) <= 0;
> > > + int tmp = *(volatile signed int *)(&(lock)->slock);
> >
> > Why is slock not volatile signed int in the first place?
>
> Don't know really. Why does spin_is_locked need it to be volatile?
I suppose in case a caller doesn't have a memory barrier
(they should in theory, but might not). Without any barrier
or volatile gcc might optimize it away.
The other accesses in spinlocks hopefully all have barriers.
Ok anyways the patches look good.
-Andi
next prev parent reply other threads:[~2007-08-09 9:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-08 4:22 [patch 1/2] spinlock: lockbreak cleanup Nick Piggin
2007-08-08 4:24 ` [patch 2/2] x86_64: ticket lock spinlock Nick Piggin
2007-08-08 10:26 ` Andi Kleen
2007-08-09 1:42 ` Nick Piggin
2007-08-09 9:54 ` Andi Kleen [this message]
2007-08-08 17:31 ` Valdis.Kletnieks
2007-08-09 1:40 ` Nick Piggin
2007-08-11 0:07 ` [patch 1/2] spinlock: lockbreak cleanup Andi Kleen
2007-08-13 7:52 ` Nick Piggin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200708091154.34581.ak@suse.de \
--to=ak@suse.de \
--cc=akpm@linux-foundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=npiggin@suse.de \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox