From patchwork Mon Feb 13 12:10:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 93869 Delivered-To: patch@linaro.org Received: by 10.140.20.99 with SMTP id 90csp1074160qgi; Mon, 13 Feb 2017 04:37:17 -0800 (PST) X-Received: by 10.200.44.83 with SMTP id e19mr19570346qta.260.1486989437476; Mon, 13 Feb 2017 04:37:17 -0800 (PST) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k3si7100762qkc.277.2017.02.13.04.37.16 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 13 Feb 2017 04:37:17 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdFsY-0004Fa-Vj for patch@linaro.org; Mon, 13 Feb 2017 07:37:15 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55217) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cdFYx-0003VL-QX for qemu-devel@nongnu.org; Mon, 13 Feb 2017 07:17:01 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cdFYw-00042k-6Z for qemu-devel@nongnu.org; Mon, 13 Feb 2017 07:16:59 -0500 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:35900) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cdFYv-00042X-W4 for qemu-devel@nongnu.org; Mon, 13 Feb 2017 07:16:58 -0500 Received: by mail-wm0-x234.google.com with SMTP id c85so306492137wmi.1 for ; Mon, 13 Feb 2017 04:16:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=L/8r7NQywDin6uVm+ne0e2Isv1ltq3Y7bDtgk8MZYlQ=; b=WwNPA09rMxuM5inMh+6df6cl3JYpyatuSQRvB/xLBg4xDK+w/ONuZpRdCRDGwQ46Ri wV3oP8iV/QQbM5BLIqc6qHHeNlBgAbHobtkBrzTFyd1uuJPaAKdsW8hyzOHH+9dMQ+42 aWJhfTicCEWTP1vqtwsohV9FpSzNao2TNj7Ys= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=L/8r7NQywDin6uVm+ne0e2Isv1ltq3Y7bDtgk8MZYlQ=; b=KWuylhO8D6xfplYhOO6AMK8BzGb9xICR3uYhSnUpjVwsSVSnw8dI4HBvQ+qmzL2ES0 7wVOoP8osUfQGX9tqP2KV24Py11adm4GLbI36l7myPM7ple1gxu+ZEPlAtXFmkW4setB Sgk1EAbIVu53EmJbk5o+vfPyv9AiuYwZqR241gWXTktpYYrnqFIKJ53COZb7NZBi99FQ W/ebH1huuvMgZpl+FHvtSX3pTBZzQBW3Ez4BiZgodZzs3/QkkZFbeCmGw0JwCKgDD6mm HjLgigA2DAuMy+z+flUTzEOROHRrNNrXBElwwQuRewAzI7k3OzYkUtY98PWEPhqUeGyF pvsA== X-Gm-Message-State: AMke39kRx0McdmjzJD3OBpRKS3OYceRJjgNeYVWn8Kw8N1labEd7cwxnuOqpw2oWTnHuTPi+ X-Received: by 10.28.48.7 with SMTP id w7mr18357913wmw.78.1486988216939; Mon, 13 Feb 2017 04:16:56 -0800 (PST) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id k142sm5131585wmg.31.2017.02.13.04.16.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Feb 2017 04:16:52 -0800 (PST) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0F2EF3E29F4; Mon, 13 Feb 2017 12:10:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net Date: Mon, 13 Feb 2017 12:10:17 +0000 Message-Id: <20170213121017.12907-25-alex.bennee@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170213121017.12907-1-alex.bennee@linaro.org> References: <20170213121017.12907-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2a00:1450:400c:c09::234 Subject: [Qemu-devel] [PATCH v12 24/24] tcg: enable MTTCG by default for ARM on x86 hosts X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mttcg@listserver.greensocs.com, nikunj@linux.vnet.ibm.com, jan.kiszka@siemens.com, mark.burton@greensocs.com, a.rigo@virtualopensystems.com, qemu-devel@nongnu.org, cota@braap.org, "open list:ARM" , serge.fdrv@gmail.com, pbonzini@redhat.com, bobby.prani@gmail.com, =?utf-8?q?Alex_Benn=C3=A9e?= , bamvor.zhangjian@linaro.org, fred.konrad@greensocs.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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 Reviewed-by: Richard Henderson Acked-by: Peter Maydell Tested-by: Pranith Kumar Reviewed-by: Pranith Kumar --- 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(+) -- 2.11.0 diff --git a/configure b/configure index 63253398a2..33d9bfb40c 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