From: 陳韋任 <chenwj@iis.sinica.edu.tw>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
i.mitsyanko@samsung.com, Evgeny Voevodin <e.voevodin@samsung.com>,
kyungmin.park@samsung.com, d.solodkiy@samsung.com,
m.kozlov@samsung.com
Subject: Re: [Qemu-devel] [PATCH v2] TCG: Convert global variables to be TLS.
Date: Thu, 1 Mar 2012 15:51:46 +0800 [thread overview]
Message-ID: <20120301075146.GA2937@cs.nctu.edu.tw> (raw)
In-Reply-To: <CAFEAcA-KJS5sUtozcK+omVGT9Bs_p4x0MhQQodgd4k5Ai5vKAw@mail.gmail.com>
> If you're serious about multithreading TCG then I think the first
> steps are:
> * fix existing race conditions
> * think very hard
> * come up with an overall design for what you're proposing
As COREMU [1] point out, current QEMU atomic instruction emulation approach is
problematic. For example, guest application might use x86 xchg instruction to
implement spin lock/unlock (addr is a shared memory space).
spin_unlock: spin_lock:
try:
r10 = 1;
xchg addr, r10;
if (r10 == 0)
goto success;
*addr = 0; fail:
pause;
if (*addr != 0)
goto fail;
goto try;
success:
After QEMU translation, guest xchg instruction becomes
spin_unlock: spin_lock:
helper_lock;
*addr = 0; T0 = r10;
T1 = *addr;
*addr = T0;
r10 = T1;
helper_unlock;
You can the see the atomicity on which spin lock/unlock rely is broken.
"*addr = 0" can happened in the between of helper_lock/helper_unlock.
COREMU solve this by using a lightway software transaction memory to emulate
atomic instructions. I think this issue is quite important if we want to make
TCG multithreaded, right? Is there a better way to solve this?
Regards,
chenwj
[1]
http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.187.6011&rep=rep1&type=pdf
--
Wei-Ren Chen (陳韋任)
Computer Systems Lab, Institute of Information Science,
Academia Sinica, Taiwan (R.O.C.)
Tel:886-2-2788-3799 #1667
Homepage: http://people.cs.nctu.edu.tw/~chenwj
next prev parent reply other threads:[~2012-03-01 7:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-27 11:06 [Qemu-devel] [PATCH] TCG: Convert global variables to be TLS Evgeny Voevodin
2012-02-27 11:06 ` Evgeny Voevodin
2012-02-27 11:43 ` Evgeny Voevodin
2012-02-27 12:13 ` [Qemu-devel] [PATCH v2] " Evgeny Voevodin
2012-02-27 12:35 ` Peter Maydell
2012-02-28 3:13 ` Evgeny Voevodin
2012-02-28 8:10 ` Peter Maydell
2012-02-29 3:26 ` 陳韋任
2012-02-29 3:43 ` Evgeny Voevodin
2012-02-29 3:46 ` 陳韋任
2012-02-29 4:01 ` Evgeny Voevodin
2012-03-01 7:51 ` 陳韋任 [this message]
2012-03-02 6:08 ` Evgeny Voevodin
2012-03-01 8:22 ` Andreas Färber
2012-03-01 8:27 ` Peter Maydell
2012-03-01 10:57 ` Evgeny Voevodin
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=20120301075146.GA2937@cs.nctu.edu.tw \
--to=chenwj@iis.sinica.edu.tw \
--cc=d.solodkiy@samsung.com \
--cc=e.voevodin@samsung.com \
--cc=i.mitsyanko@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=m.kozlov@samsung.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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).