[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v13 24/24] tcg: enable MTTCG by default for ARM on x
From: |
Alex Bennée |
Subject: |
[Qemu-devel] [PATCH v13 24/24] tcg: enable MTTCG by default for ARM on x86 hosts |
Date: |
Wed, 22 Feb 2017 17:13:27 +0000 |
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 powerctl changes 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 <address@hidden>
Reviewed-by: Richard Henderson <address@hidden>
Acked-by: Peter Maydell <address@hidden>
Tested-by: Pranith Kumar <address@hidden>
Reviewed-by: Pranith Kumar <address@hidden>
---
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
v11
- add Pranith's tested/review-by tags
- s/defer reset/defer powerctl/ in commit message
---
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 1c9655e639..3897dbe583 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 e285ba3b4b..38a8e00908 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
- [Qemu-devel] [PATCH v13 13/24] cputlb: add assert_cpu_is_self checks, (continued)
- [Qemu-devel] [PATCH v13 13/24] cputlb: add assert_cpu_is_self checks, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 08/24] tcg: drop global lock during TCG code execution, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 19/24] cputlb: introduce tlb_flush_*_all_cpus[_synced], Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 15/24] cputlb: introduce tlb_flush_* async work., Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 12/24] tcg: handle EXCP_ATOMIC exception for system emulation, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 17/24] cputlb: add tlb_flush_by_mmuidx async routines, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 23/24] hw/misc/imx6_src: defer clearing of SRC_SCR reset bits, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 16/24] cputlb and arm/sparc targets: convert mmuidx flushes from varg to bitmap, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 22/24] target-arm: ensure all cross vCPUs TLB flushes complete, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 20/24] target-arm/powerctl: defer cpu reset work to CPU context, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 24/24] tcg: enable MTTCG by default for ARM on x86 hosts,
Alex Bennée <=
- [Qemu-devel] [PATCH v13 21/24] target-arm: don't generate WFE/YIELD calls for MTTCG, Alex Bennée, 2017/02/22
- [Qemu-devel] [PATCH v13 18/24] cputlb: atomically update tlb fields used by tlb_reset_dirty, Alex Bennée, 2017/02/22
- Re: [Qemu-devel] [PATCH v13 00/24] MTTCG Base enabling patches with ARM enablement, no-reply, 2017/02/22