* [Qemu-devel] Implementing atomic SWP in qemu-arm
@ 2010-08-18 19:15 Peter W Schultz
2010-08-18 19:37 ` Nathan Froyd
0 siblings, 1 reply; 2+ messages in thread
From: Peter W Schultz @ 2010-08-18 19:15 UTC (permalink / raw)
To: qemu-devel
It is my job to make qemu-arm implement the SWPcc instruction
atomically. Currently, qemu implements this instruction as a load
followed by a store, in a way vulnerable to race conditions.
We are extending qemu to handle a high number of processors, and our
simple testcase using pthreads seems to cause a deadlock somewhere in
qemu. It is the beliefs of my professor and I that the implementation
of SWP is the reason.
How would I go about modifying the qemu source to implement SWP
atomically? I have been studying the source for a few days now, and I
am at a loss as to what all needs to be done.
I feel it would be most desirable to add a TCG_SWAP instruction that
is guaranteed to be an atomic compare-and-swap, and implement that as
needed.
Best,
Kaedenn
--
Undergraduate Student
University of California, Santa Cruz
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] Implementing atomic SWP in qemu-arm
2010-08-18 19:15 [Qemu-devel] Implementing atomic SWP in qemu-arm Peter W Schultz
@ 2010-08-18 19:37 ` Nathan Froyd
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Froyd @ 2010-08-18 19:37 UTC (permalink / raw)
To: Peter W Schultz; +Cc: qemu-devel
On Wed, Aug 18, 2010 at 12:15:09PM -0700, Peter W Schultz wrote:
> How would I go about modifying the qemu source to implement SWP
> atomically? I have been studying the source for a few days now, and I
> am at a loss as to what all needs to be done.
You should look at how the load/store-exclusive instructions work and
see if you can use a similar mechanism. It should be fairly
straightforward.
> I feel it would be most desirable to add a TCG_SWAP instruction that
> is guaranteed to be an atomic compare-and-swap, and implement that as
> needed.
I believe there was an thread several months ago discussing doing this
or something similar and it was decided that mechanism was not the way
to go.
-Nathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-08-18 19:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-18 19:15 [Qemu-devel] Implementing atomic SWP in qemu-arm Peter W Schultz
2010-08-18 19:37 ` Nathan Froyd
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).