why isync in atomic icc and return and atomic dec and return for CONFIG_SMP

Anton Blanchard anton at samba.org
Wed Jul 24 10:30:40 EST 2002


Hi Kevin,

> Can anyone tell me the reason why we need to use an isync in the
> atomic_add_return and atomic_sub_return (see kernel source in
> asm/atomic.h) only for SMP machiens and only when a value is returned?

We are using isync here as an "import barrier". The stwcx., bne, isync
sequence ensures that any instructions following the isync are not
performed until the lock has been taken. Basically it prevents anything
inside the spinlock protected region from leaking outside.

We dont need this on a UP machine because the local cpu sees everything
in program order.

Anton

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/





More information about the Linuxppc-dev mailing list