qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: 陳韋任 <chenwj@iis.sinica.edu.tw>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Rajat Goyal" <rajat.goyal.90@gmail.com>,
	qemu-devel@nongnu.org, 陳韋任 <chenwj@iis.sinica.edu.tw>
Subject: Re: [Qemu-devel] Get only TCG code without execution
Date: Fri, 20 Jan 2012 17:44:47 +0800	[thread overview]
Message-ID: <20120120094447.GA7844@cs.nctu.edu.tw> (raw)
In-Reply-To: <CAFEAcA8Ci6kwZ_+tswHT5UuAzt+YezOm24FhTbBAxZ1sgX3cGg@mail.gmail.com>

On Fri, Jan 20, 2012 at 09:09:46AM +0000, Peter Maydell wrote:
> On 20 January 2012 06:12, 陳韋任 <chenwj@iis.sinica.edu.tw> wrote:
> >  Out of curiosity. What's ARM memory model? From the Wikipedia [1], it seems
> > ARMv7 has the same memory model as IA64.
> 
> The ARM memory model is the set of semantics for memory
> accesses as defined in the ARM Architecture Reference
> Manual (covering not just reordering but also exclusive
> accesses, alignment, barriers, etc). The manual devotes
> 50 pages to it so I'm not about to try to summarise it here :-)

  Seems the Wikipedia only lists the memory ordering part. ;)
 
> > And as a general emulator, QEMU shouldn't implement any
> > architecture-specific memory model, right?
> 
> Wrong, at least in theory. Ideally QEMU should implement exactly
> the semantics required by the guest architecture memory model
> (it's allowed to be stricter than the architecture requires, of
> course), in the same way it should implement the semantics required
> by the guest architecture instruction set. A guest binary for ARM
> can rely on the memory ordering constraints imposed by the memory
> model just as much as it can rely on the fact that the ADD instruction
> adds two registers together. In practice, of course (a) this is an
> enormous amount of work and also slows the emulator down drastically
> and (b) guest binaries don't actually rely that much on the memory
> model. And the fairly strict memory model provided by x86 means that
> for x86 hosts we actually get most of the important bits of the guest
> memory model right anyway.

  AFAIK, LLVM defines it's own memory model [1] which is inspired by the C++11
memory model. That's why I think instead of implementing architecture-specific
memory model, QEMU should define a more general (strict) one.

  You said,

  "guest binaries don't actually rely that much on the memory model."

I think the reason is those guest binaries are single thread. Memory model is
important in multi-threaded case. BTW, our binary translator now can translate
x86 binary to ARM binary, and ARM has weaker memory model than x86.
 
[1] http://llvm.org/docs/LangRef.html#memmodel

Regards,
chenwj

P.S. Happy Chinese New Year. :)

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

  reply	other threads:[~2012-01-20  9:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-15 23:09 [Qemu-devel] Get only TCG code without execution Rajat Goyal
2012-01-16  5:32 ` Mulyadi Santosa
2012-01-16  8:41 ` Stefan Hajnoczi
2012-01-16 12:23   ` Rajat Goyal
2012-01-16 12:29     ` Peter Maydell
2012-01-17  1:04       ` 陳韋任
2012-01-17  8:33         ` Peter Maydell
2012-01-19 16:00           ` Rajat Goyal
2012-01-19 16:15             ` Peter Maydell
2012-01-20  6:38               ` 陳韋任
2012-01-21  0:21                 ` Jamie Lokier
2012-02-02 19:35                   ` Rajat Goyal
2012-01-20  6:12             ` 陳韋任
2012-01-20  9:09               ` Peter Maydell
2012-01-20  9:44                 ` 陳韋任 [this message]
2012-01-20 10:46                   ` Peter Maydell
2012-01-20 19:40                     ` Jamie Lokier
2012-02-06  7:25                       ` 陳韋任
2012-02-10  3:08                         ` Jamie Lokier

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=20120120094447.GA7844@cs.nctu.edu.tw \
    --to=chenwj@iis.sinica.edu.tw \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rajat.goyal.90@gmail.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).