Subject: Re: why isync in atomic icc and return and atomic dec and return for CONFIG_SMP

From: Anton Blanchard <[email-masked]>
Date: Wed, 24 Jul 2002 10:30:40 +1000

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/