Re: [PATCH -tip] x86: atomic64: inline atomic64_read()

From: Ingo Molnar
Date: Fri Jul 03 2009 - 14:44:21 EST



* Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:

> On Fri, 3 Jul 2009 20:18:15 +0200
> Ingo Molnar <mingo@xxxxxxx> wrote:
>
> >
> > * Arjan van de Ven <arjan@xxxxxxxxxxxxx> wrote:
> >
> > > On Fri, 3 Jul 2009 20:04:50 +0200
> > > Ingo Molnar <mingo@xxxxxxx> wrote:
> > >
> > > > > +static inline u64 atomic64_read(atomic64_t *ptr)
> > > > > +{
> > > > > + u64 res;
> > > > > +
> > > > > + asm volatile(
> > > > > + "mov %%ebx, %%eax\n\t"
> > > > > + "mov %%ecx, %%edx\n\t"
> > > > > + LOCK_PREFIX "cmpxchg8b %1\n"
> > >
> > > also afaik cmpxchg implies the lock prefix, so no need to make an
> > > explicit one... it just adds code size and alternatives-work
> >
> > good point!
> >
> > Is the same true of XADD as well? If yes then we can remove the lock
> > prefix from those as well - there's a few uses of that on 32-bit and
> > 64-bit as well.
> >
>
> ok never mind I was wrong,
> it seems cmpxchg does NOT imply a lock prefix, nor does xadd.

Indeed, i just checked the SDM and the lock prefix is not implicit.

Ignore the patch i sent out ;-)

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/