linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Kevin B. Hendricks" <kevin.hendricks@sympatico.ca>
To: Anton Blanchard <anton@samba.org>
Cc: linuxppc-dev@lists.linuxppc.org,
	yellowdog-devel@lists.terrasoftsolutions.com
Subject: Re: why isync in atomic icc and return and atomic dec and return for CONFIG_SMP
Date: Wed, 24 Jul 2002 08:04:36 -0400	[thread overview]
Message-ID: <200207240804.36472.kevin.hendricks@sympatico.ca> (raw)
In-Reply-To: <20020724003040.GE6355@krispykreme>


Hi,

> > 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.

So the atomic increment and decrement awith return are being used  in locks
to protect extended criticial regions?

If so, a lock (of any sort) does require an isync (according to the manual)
immediately after gaining the lock to make sure all speculative
prefetching of instructions and data (possibly stale since someone else
could have changed them before dropping the lock) should be done for pboth
cases.

Why doesn't the same problem happen from the processor's speculative
prefetching of instructions in the uniprocessor case?  Since that routine
is inlined, the single processor could have loaded and started to process
instructions past the "lock" before it actually aaquires the lock.

Kevin


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

  reply	other threads:[~2002-07-24 12:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-23 21:25 why isync in atomic icc and return and atomic dec and return for CONFIG_SMP Kevin B. Hendricks
2002-07-23 22:15 ` Kevin B. Hendricks
2002-07-24  0:30 ` Anton Blanchard
2002-07-24 12:04   ` Kevin B. Hendricks [this message]
2002-07-28  2:26     ` Anton Blanchard
2002-08-03 14:28       ` Kevin B. Hendricks
2002-08-04 14:26         ` Michael R. Zucca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200207240804.36472.kevin.hendricks@sympatico.ca \
    --to=kevin.hendricks@sympatico.ca \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@lists.linuxppc.org \
    --cc=yellowdog-devel@lists.terrasoftsolutions.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).