From: "Alex Bennée" <alex.bennee@linaro.org>
To: peter.maydell@linaro.org, rth@twiddle.net
Cc: mttcg@listserver.greensocs.com, qemu-devel@nongnu.org,
fred.konrad@greensocs.com, a.rigo@virtualopensystems.com,
cota@braap.org, bobby.prani@gmail.com, nikunj@linux.vnet.ibm.com,
mark.burton@greensocs.com, pbonzini@redhat.com,
jan.kiszka@siemens.com, serge.fdrv@gmail.com,
bamvor.zhangjian@linaro.org,
"Alex Bennée" <alex.bennee@linaro.org>,
"open list:ARM" <qemu-arm@nongnu.org>
Subject: [Qemu-devel] [PATCH v10 23/23] tcg: enable MTTCG by default for ARM on x86 hosts
Date: Mon, 6 Feb 2017 15:31:13 +0000 [thread overview]
Message-ID: <20170206153113.27729-24-alex.bennee@linaro.org> (raw)
In-Reply-To: <20170206153113.27729-1-alex.bennee@linaro.org>
This enables the multi-threaded system emulation by default for ARMv7
and ARMv8 guests using the x86_64 TCG backend. This is because on the
guest side:
- The ARM translate.c/translate-64.c have been converted to
- use MTTCG safe atomic primitives
- emit the appropriate barrier ops
- The ARM machine has been updated to
- hold the BQL when modifying shared cross-vCPU state
- defer cpu_reset to async safe work
All the host backends support the barrier and atomic primitives but
need to provide same-or-better support for normal load/store
operations.
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
---
v7
- drop configure check for backend
- declare backend memory order for x86
- declare guest memory order for ARM
- add configure snippet to set TARGET_SUPPORTS_MTTCG
v8
- TCG_DEFAULT_MO -> TCG_GUEST_DEFAULT_MO
- ~TCG_MO_LD_ST -> ~TCG_MO_ST_LD
v10
- moved TCG_DEFAULT_MO -> TCG_GUEST_DEFAULT_MO to original commit
---
configure | 6 ++++++
target/arm/cpu.h | 3 +++
tcg/i386/tcg-target.h | 11 +++++++++++
3 files changed, 20 insertions(+)
diff --git a/configure b/configure
index 86fd833feb..9f2a665f5b 100755
--- a/configure
+++ b/configure
@@ -5879,6 +5879,7 @@ mkdir -p $target_dir
echo "# Automatically generated by configure - do not modify" > $config_target_mak
bflt="no"
+mttcg="no"
interp_prefix1=$(echo "$interp_prefix" | sed "s/%M/$target_name/g")
gdb_xml_files=""
@@ -5897,11 +5898,13 @@ case "$target_name" in
arm|armeb)
TARGET_ARCH=arm
bflt="yes"
+ mttcg="yes"
gdb_xml_files="arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
;;
aarch64)
TARGET_BASE_ARCH=arm
bflt="yes"
+ mttcg="yes"
gdb_xml_files="aarch64-core.xml aarch64-fpu.xml arm-core.xml arm-vfp.xml arm-vfp3.xml arm-neon.xml"
;;
cris)
@@ -6066,6 +6069,9 @@ if test "$target_bigendian" = "yes" ; then
fi
if test "$target_softmmu" = "yes" ; then
echo "CONFIG_SOFTMMU=y" >> $config_target_mak
+ if test "$mttcg" = "yes" ; then
+ echo "TARGET_SUPPORTS_MTTCG=y" >> $config_target_mak
+ fi
fi
if test "$target_user_only" = "yes" ; then
echo "CONFIG_USER_ONLY=y" >> $config_target_mak
diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index b8f82d5d20..44026d7c98 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -30,6 +30,9 @@
# define TARGET_LONG_BITS 32
#endif
+/* ARM processors have a weak memory model */
+#define TCG_GUEST_DEFAULT_MO (0)
+
#define CPUArchState struct CPUARMState
#include "qemu-common.h"
diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h
index 21d96ec35c..4275787db9 100644
--- a/tcg/i386/tcg-target.h
+++ b/tcg/i386/tcg-target.h
@@ -165,4 +165,15 @@ static inline void flush_icache_range(uintptr_t start, uintptr_t stop)
{
}
+/* This defines the natural memory order supported by this
+ * architecture before guarantees made by various barrier
+ * instructions.
+ *
+ * The x86 has a pretty strong memory ordering which only really
+ * allows for some stores to be re-ordered after loads.
+ */
+#include "tcg-mo.h"
+
+#define TCG_TARGET_DEFAULT_MO (TCG_MO_ALL & ~TCG_MO_ST_LD)
+
#endif
--
2.11.0
next prev parent reply other threads:[~2017-02-06 15:36 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 15:30 [Qemu-devel] [PATCH v10 00/23] MTTCG Base enabling patches with ARM enablement Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 01/23] docs: new design document multi-thread-tcg.txt Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 02/23] mttcg: translate-all: Enable locking debug in a debug build Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 03/23] mttcg: Add missing tb_lock/unlock() in cpu_exec_step() Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 04/23] tcg: move TCG_MO/BAR types into own file Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 05/23] tcg: add options for enabling MTTCG Alex Bennée
2017-02-07 2:27 ` Pranith Kumar
2017-02-07 10:06 ` Alex Bennée
2017-02-08 21:35 ` Pranith Kumar
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 06/23] tcg: add kick timer for single-threaded vCPU emulation Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 07/23] tcg: rename tcg_current_cpu to tcg_current_rr_cpu Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 08/23] tcg: drop global lock during TCG code execution Alex Bennée
2017-02-06 15:30 ` [Qemu-devel] [PATCH v10 09/23] tcg: remove global exit_request Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 10/23] tcg: enable tb_lock() for SoftMMU Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 11/23] tcg: enable thread-per-vCPU Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 12/23] tcg: handle EXCP_ATOMIC exception for system emulation Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 13/23] cputlb: add assert_cpu_is_self checks Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 14/23] cputlb: tweak qemu_ram_addr_from_host_nofail reporting Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 15/23] cputlb: introduce tlb_flush_* async work Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 16/23] cputlb and arm/sparc targets: convert mmuidx flushes from varg to bitmap Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 17/23] cputlb: add tlb_flush_by_mmuidx async routines Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 18/23] cputlb: atomically update tlb fields used by tlb_reset_dirty Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 19/23] cputlb: introduce tlb_flush_*_all_cpus[_synced] Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 20/23] target-arm/powerctl: defer cpu reset work to CPU context Alex Bennée
2017-02-07 15:23 ` Peter Maydell
2017-02-07 16:52 ` Alex Bennée
2017-02-07 17:17 ` Peter Maydell
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 21/23] target-arm: don't generate WFE/YIELD calls for MTTCG Alex Bennée
2017-02-06 15:31 ` [Qemu-devel] [PATCH v10 22/23] target-arm: ensure all cross vCPUs TLB flushes complete Alex Bennée
2017-02-06 16:43 ` Peter Maydell
2017-02-06 15:31 ` Alex Bennée [this message]
2017-02-06 19:06 ` [Qemu-devel] [PATCH v10 00/23] MTTCG Base enabling patches with ARM enablement Pranith Kumar
2017-02-06 20:05 ` Eric Blake
2017-02-07 10:07 ` Alex Bennée
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=20170206153113.27729-24-alex.bennee@linaro.org \
--to=alex.bennee@linaro.org \
--cc=a.rigo@virtualopensystems.com \
--cc=bamvor.zhangjian@linaro.org \
--cc=bobby.prani@gmail.com \
--cc=cota@braap.org \
--cc=fred.konrad@greensocs.com \
--cc=jan.kiszka@siemens.com \
--cc=mark.burton@greensocs.com \
--cc=mttcg@listserver.greensocs.com \
--cc=nikunj@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=serge.fdrv@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).