From patchwork Fri Apr 15 14:23:51 2016 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: 65932 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp1216999qge; Fri, 15 Apr 2016 07:33:33 -0700 (PDT) X-Received: by 10.55.197.203 with SMTP id k72mr18142872qkl.15.1460730813203; Fri, 15 Apr 2016 07:33:33 -0700 (PDT) Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h81si36656612qhc.41.2016.04.15.07.33.33 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 15 Apr 2016 07:33:33 -0700 (PDT) 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 dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35281 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar4oO-0001yy-Nb for patch@linaro.org; Fri, 15 Apr 2016 10:33:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar4ll-0006Nn-Ie for qemu-devel@nongnu.org; Fri, 15 Apr 2016 10:30:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ar4lg-00016i-Sy for qemu-devel@nongnu.org; Fri, 15 Apr 2016 10:30:49 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:35784) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ar4lg-00016e-NW for qemu-devel@nongnu.org; Fri, 15 Apr 2016 10:30:44 -0400 Received: by mail-wm0-x236.google.com with SMTP id a140so34065560wma.0 for ; Fri, 15 Apr 2016 07:30:44 -0700 (PDT) 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=pmT+8eRv9fe/gSeAd0n4hI1WrBTFVaf6n7mgAgcsDgk=; b=NaQmr02wYj968FV64sHn8xqCwYxo7okK3yRg/PL83kehhAvn5ni4FTyiV1Nki1Lw2Y 62S3CniO1MHW3VIWptCfpD9tASz4RGBnQTeOCNvco/bD7hv+hyMI08oY11Q/p52C4NK+ rqMrPMkCI+cwdiy24bNmJllUPeAV3ui+wkjOI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pmT+8eRv9fe/gSeAd0n4hI1WrBTFVaf6n7mgAgcsDgk=; b=ALkxFJ7vBsBsA58gzPkDHIIyR1eAS9048+AJTzCpj4FlGhBlV0tacCt6LUjUCVTPPe NrmQ6XhqE95cirxaeWn74BZVngsbHl8leN1LxcjaVHH9dBDYqg7mUBRsuFiGi5bIFKwl 7qF+aCE2TbiQ9BVy69dZGWVYSWANL/hRN3G6ALKOjCETDUXHrK6Da/T8EJ7OFXkxelso EwgHMrM/oeUfjoUM2NxCAre96XCUZi1PH25YaBBhxozpP+VXTzEnNc1VXBrU0I3WecPn 0TTuDPf/7v9Bu/Oui0pc7NNWFDGh5PgOyRKXVwG7tunszL1xXGZ6Y0bqwKofV6a6YU2k aZiQ== X-Gm-Message-State: AOPr4FWxkfy/1+JxIrz6r7AncK4CyKCRh7w56uRvWMXlHjWzrkWpdLQHdfjwmrk882+RR5Lh X-Received: by 10.194.6.36 with SMTP id x4mr22172673wjx.122.1460730644093; Fri, 15 Apr 2016 07:30:44 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id vu4sm10835242wjc.27.2016.04.15.07.30.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Apr 2016 07:30:42 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 507943E05EA; Fri, 15 Apr 2016 15:24:05 +0100 (BST) From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: mttcg@listserver.greensocs.com, fred.konrad@greensocs.com, a.rigo@virtualopensystems.com, serge.fdrv@gmail.com, cota@braap.org Date: Fri, 15 Apr 2016 15:23:51 +0100 Message-Id: <1460730231-1184-14-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1460730231-1184-1-git-send-email-alex.bennee@linaro.org> References: <1460730231-1184-1-git-send-email-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::236 Subject: [Qemu-devel] [RFC v1 12/12] cpus: default MTTCG to on for 32 bit ARM on x86 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: peter.maydell@linaro.org, claudio.fontana@huawei.com, Peter Crosthwaite , jan.kiszka@siemens.com, mark.burton@greensocs.com, qemu-devel@nongnu.org, pbonzini@redhat.com, =?UTF-8?q?Alex=20Benn=C3=A9e?= , rth@twiddle.net Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This makes multi-threading the default for 32 bit ARM on x86. It has been tested with Debian Jessie as well as my extended KVM unit tests which stress the SMC and TB invalidation code. Those tests can be found at: https://github.com/stsquad/kvm-unit-tests/tree/mttcg/current-tests-v5 Signed-off-by: Alex Bennée --- cpus.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/cpus.c b/cpus.c index 860e2a9..daa92c7 100644 --- a/cpus.c +++ b/cpus.c @@ -171,12 +171,24 @@ opts_init(tcg_register_config); static bool default_mttcg_enabled(void) { - /* - * TODO: Check if we have a chance to have MTTCG working on this guest/host. - * Basically is the atomic instruction implemented? Is there any - * memory ordering issue? + /* Checklist for enabling MTTCG on a given frontend/backend combination + * + * - Are atomics correctly modelled for an MTTCG environment + * - If the backend is weakly ordered + * - has the front-end implemented explicit memory ordering ops + * - does the back-end generate code to ensure memory ordering */ +#if defined(__i386__) || defined(__x86_64__) + /* x86 backend is strongly ordered which helps a lot */ + #if defined(TARGET_ARM) + return true; + #else + return false; + #endif +#else + /* Until memory ordering implemented things will likely break */ return false; +#endif } void qemu_tcg_configure(QemuOpts *opts)