[parisc-linux] missing barrier in _raw_spin_lock?
John David Anglin
dave at hiauly1.hia.nrc.ca
Sun Jan 25 17:13:47 MST 2004
> > #define __ldcw(a) ({ \
> > unsigned int __ret; \
> > __asm__ __volatile__("ldcw 0(%2),%0" \
> > : "=r" (__ret), "=m" (*(a)) : "r" (a)); \
> > __ret; \
> > })
> I suppose the memory operand specification is required here. Newer
> compilers (especially gcc-3.4) can optimize away local variables if you
> only access the address but not the contents. I think even your
> pthreads version is not really correct, because it specifies (*(a)) as
> output only instead of inout.
I agree.
> No, putting the barrier into __ldcw is wrong because it would impact all
> other uses of __ldcw that don't need the barrier. AFAICS, the
The only other uses for __ldcw are the SPIN_LOCK macro in atomic.h
and the _raw_spin_trylock in spinlock.h (i.e., it is only used
acquire locks). If all these need barriers, then it might as well
be in __ldcw.
Dave
--
J. David Anglin dave.anglin at nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
More information about the parisc-linux
mailing list