[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080305002626.GD9517@linux.vnet.ibm.com>
Date: Tue, 4 Mar 2008 16:26:26 -0800
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: "Rafael J. Wysocki" <rjw@...k.pl>
Cc: Peter Hartley <pdh@...er.chaos.org.uk>,
linux-kernel@...r.kernel.org, Pavel Machek <pavel@....cz>,
Alan Cox <alan@...rguk.ukuu.org.uk>,
Alan Stern <stern@...land.harvard.edu>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...l.org>,
Zdenek Kabelac <zdenek.kabelac@...il.com>, davem@...emloft.net,
Pierre Ossman <drzeus-mmc@...eus.cx>
Subject: Re: [patch] Re: using long instead of atomic_t when only set/read is required
On Wed, Mar 05, 2008 at 12:54:03AM +0100, Rafael J. Wysocki wrote:
> On Wednesday, 5 of March 2008, Peter Hartley wrote:
> > On Mon, 2008-03-03 at 18:24 +0100, Pavel Machek wrote:
> > > Ok, I can understand the gcc side. But do we actually run on an
> > > architecture where
> > >
> > > long *x;
> > >
> > > *x = 0;
> > >
> > > racing with
> > >
> > > *x = 0x12345678;
> > >
> > > can produce
> > >
> > > *x == 0x12340000;
> > >
> > > or something like that? I'm told RCU relies on architectures not doing
> > > this, and I'd like to get this clarified.
> >
> > ARM6, ARM7500 and similar do exactly this for short (and unsigned
> > short), although not for int, long, or pointers:
> >
> > > struct foo { short b; short c; };
> > > void baa(struct foo *f, short cc) { f->c = cc; }
> >
> > becomes (arm-linux-gcc -mcpu=arm6):
> >
> > > baa:
> > > mov r3, r1, lsr #8
> > > strb r3, [r0, #3]
> > > strb r1, [r0, #2]
> > > mov pc, lr
> >
> > note the two single-byte stores, as ARM6 didn't have the "store
> > halfword" instruction.
> >
> > So I think Alan Stern's
> > "For all properly-aligned pointer and integral types other than long
> > long..."
> > should be amended to
> > "For all properly-aligned pointer and integral types other than short or
> > long long..."
>
> Well, perhaps it's sufficient to document just pointers? In fact this is what
> RCU relies on.
One can do RCU on array indexes (ints/longs) as well as pointers, so we
need to keep "integral" in there.
Thanx, Paul
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists