From: "Michael R. Zucca" <mrz5149@acm.org>
To: Kalle Pokki <kalle.pokki@iki.fi>
Cc: linuxppc-embedded <linuxppc-embedded@ozlabs.org>
Subject: Re: PowerPC reservations
Date: Thu, 10 Nov 2005 10:20:55 -0500 [thread overview]
Message-ID: <43736557.6020008@acm.org> (raw)
In-Reply-To: <437302CE.8070309@iki.fi>
Kalle Pokki wrote:
> Am I just not getting how this is really supposed to work? Are there
> still some other constructs in use to prevent this, e.g. extra stwcx.
> instructions when changing the thread of execution?
Yes. When a context switch occurs, there's a stcwx. to clear any
reservations from the previous thread. When you enter another thread
from a context switch, you enter it with no reservations pending.
So you might have something that looks like this:
thread 1 -> lwarx w/ successful reservation
context switch -> stwcx.. to garbage location to clear any reservations
thread 2 -> stwcx. fails since there's no reservation pending
context switch -> stwcx. to garbage location to clear any reservations
thread 1 -> stwcx. fails since there's no reservation pending
thread 1 -> loops to try lwarx again
So the context switcher protects a reservation from "leaking" into
another thread. In that sense, you can act as though lwarx/stwcx. pairs
belong to a single thread.
The other important thing to remember is that there can only be one
outstanding reservation. Thus, lwarx and stcwx. instructions have to be
"paired" or you're going to get unexpected results.
prev parent reply other threads:[~2005-11-10 15:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-10 8:20 PowerPC reservations Kalle Pokki
2005-11-10 15:20 ` Michael R. Zucca [this message]
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=43736557.6020008@acm.org \
--to=mrz5149@acm.org \
--cc=kalle.pokki@iki.fi \
--cc=linuxppc-embedded@ozlabs.org \
/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).