From patchwork Wed Oct 25 09:35:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 117081 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp656983qgn; Wed, 25 Oct 2017 03:04:54 -0700 (PDT) X-Google-Smtp-Source: ABhQp+TbT+zdgjVGaT9uFpOZLJNM/HTO90QKNiAcky6y40oPQXbreigMsRv7tLAlvZUwpBGlMgdC X-Received: by 10.37.80.150 with SMTP id e144mr876208ybb.482.1508925894776; Wed, 25 Oct 2017 03:04:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508925894; cv=none; d=google.com; s=arc-20160816; b=yghKr+L6lnsiZaYGwHX3b6QsB59Hbeneae5OQe2jJJo3EeXnE6KZcuslay6bz7d1sO EaCgpKn9vOytDB9D9FE1vb4eHtXft0voPMlUnKmZLamQVsRr/3p7PMkKFcYV/QQebPEX kTT1imsWfZr4Y4DeGPeXOnVG8QErvGcpfLbZmAZCGE/XKIWhrZbtC2h2RcZiXbtxEPml WhXIKb0ckimsQMXsbVnhDm4PBTJMbWwVGpS95IKCc5fMefbyUiuAPtpsNIqAgmbRSkkP PN7OYp1okMD3QBwbBxQrhdJYMcedYAXOltnJRfXXfYqG9n29j6c2QQLk8JWAFAUtDt4J l/uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=S9H5rFy5Tq6a7xTO8lxuMsMw0wYO7qlJtOE/jDeYKrk=; b=GabjRG1mgJzrxbCMbFQ04TEkTAh9B4mvaApV8vSFia3TBR5lPgTUNQ9u3Teo4AmOZo UWmwHRwUAa6+pirQIA8TvK8HXbPj+0xkiL6D+9+U9H6R7feJ7uz++dFT37J6qXVJZ2H6 6tpOfNc6ZUiGqvfBAj7i4lmfpOUj+6cFKmDUYTtDQ8Ij4SEBGWDqPbKDAf7ECqMr80MO nm6TUzujiyW8TTUKZRvpwq6A/lbrLYf+P8fygvaRUWhrYvDw98N4Vx2DVzlUDfej79BE 88+za5pwNTnT8SROi2QpSekIRoB2lPGMiz8xoewHuUhUOnJscI6mIChkU5c99HQDuibO ETKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=cZMiJyB4; 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 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id g2si384537ywl.467.2017.10.25.03.04.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 25 Oct 2017 03:04:54 -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 header.s=google header.b=cZMiJyB4; 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]:47431 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7IYQ-00086x-Bc for patch@linaro.org; Wed, 25 Oct 2017 06:04:54 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45879) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7I6o-00007o-FH for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:36:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7I6n-0008U1-FB for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:36:22 -0400 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:52170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7I6n-0008TB-8l for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:36:21 -0400 Received: by mail-wm0-x241.google.com with SMTP id b9so662984wmh.0 for ; Wed, 25 Oct 2017 02:36:21 -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; bh=S9H5rFy5Tq6a7xTO8lxuMsMw0wYO7qlJtOE/jDeYKrk=; b=cZMiJyB4jEjmF6uatekqa99hwFx/miNIWYnBlWBhlHgGSSoG4npTR3RohL/FAp9PoT AkjGPnLYBDo9YYOyl2sx2h6etJj+i7xJAc9eV81+g0n8b5pTdm1I5OIB0hDMu9VvkG5F QUEV5d/uy9I5jhSmMR74EBDTZPkLp79290nME= 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; bh=S9H5rFy5Tq6a7xTO8lxuMsMw0wYO7qlJtOE/jDeYKrk=; b=VX3fERVLRSKgxjqMlLApNb+zEIhYohhNoR2UcUICdiuYZLeMz3xCiJarrW2QnFN1EQ bpNf/B1DrnVHnuOhd8KNtASexVXVl9+3Tnm8KBl+/ddPYC6z5587hDmNIgKclwSIkSRc m4DyfCDQZrNw7AjxZdmAHigw2tzffQmqDlOMyShlKyPQlKQrJKSi6SoJpYEA692w1gdw VxxMJy7Fefec+Qkg5ws64Rx35J4Gb1sPQ3DVMV/00IQ7kef84bazzUrJEiN94RSaOrvR H6SsoXSj/lvw/2Vyroxt0NA2uYhATBllNAT1SahK6DuMpABASoPTAzE8czdLaCcNj8+V jDCQ== X-Gm-Message-State: AMCzsaVeo5UEXQ9zIBhcuW7fC9+1+NyZ7t/737J01eO1EsRZKzrWgzE7 mIQ8njpvgyEEq9VsfXOQABEHdZCLFTU= X-Received: by 10.28.213.143 with SMTP id m137mr1073433wmg.67.1508924179690; Wed, 25 Oct 2017 02:36:19 -0700 (PDT) Received: from cloudburst.twiddle.net ([62.168.35.107]) by smtp.gmail.com with ESMTPSA id v23sm2751025wmh.8.2017.10.25.02.36.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2017 02:36:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 25 Oct 2017 11:35:17 +0200 Message-Id: <20171025093535.10175-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171025093535.10175-1-richard.henderson@linaro.org> References: <20171025093535.10175-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 33/51] tcg: check CF_PARALLEL instead of parallel_cpus 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, "Emilio G. Cota" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: "Emilio G. Cota" Thereby decoupling the resulting translated code from the current state of the system. The tb->cflags field is not passed to tcg generation functions. So we add a field to TCGContext, storing there a copy of tb->cflags. Most architectures have <= 32 registers, which results in a 4-byte hole in TCGContext. Use this hole for the new field. Reviewed-by: Richard Henderson Signed-off-by: Emilio G. Cota Signed-off-by: Richard Henderson --- tcg/tcg.h | 1 + accel/tcg/translate-all.c | 1 + tcg/tcg-op.c | 10 +++++----- 3 files changed, 7 insertions(+), 5 deletions(-) -- 2.13.6 diff --git a/tcg/tcg.h b/tcg/tcg.h index 92d7468cec..7c39eac428 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -614,6 +614,7 @@ struct TCGContext { uintptr_t *tb_jmp_target_addr; /* tb->jmp_target_arg if !direct_jump */ TCGRegSet reserved_regs; + uint32_t tb_cflags; /* cflags of the current TB */ intptr_t current_frame_offset; intptr_t frame_start; intptr_t frame_end; diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index 91fd6e444b..dcd47cd692 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1296,6 +1296,7 @@ TranslationBlock *tb_gen_code(CPUState *cpu, tb->flags = flags; tb->cflags = cflags; tb->trace_vcpu_dstate = *cpu->trace_dstate; + tcg_ctx.tb_cflags = cflags; #ifdef CONFIG_PROFILER tcg_ctx.tb_count1++; /* includes aborted translations because of diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 9561510d9c..8c7668de60 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -121,7 +121,7 @@ void tcg_gen_op6(TCGOpcode opc, TCGArg a1, TCGArg a2, TCGArg a3, void tcg_gen_mb(TCGBar mb_type) { - if (parallel_cpus) { + if (tcg_ctx.tb_cflags & CF_PARALLEL) { tcg_gen_op1(INDEX_op_mb, mb_type); } } @@ -2780,7 +2780,7 @@ void tcg_gen_atomic_cmpxchg_i32(TCGv_i32 retv, TCGv addr, TCGv_i32 cmpv, { memop = tcg_canonicalize_memop(memop, 0, 0); - if (!parallel_cpus) { + if (!(tcg_ctx.tb_cflags & CF_PARALLEL)) { TCGv_i32 t1 = tcg_temp_new_i32(); TCGv_i32 t2 = tcg_temp_new_i32(); @@ -2824,7 +2824,7 @@ void tcg_gen_atomic_cmpxchg_i64(TCGv_i64 retv, TCGv addr, TCGv_i64 cmpv, { memop = tcg_canonicalize_memop(memop, 1, 0); - if (!parallel_cpus) { + if (!(tcg_ctx.tb_cflags & CF_PARALLEL)) { TCGv_i64 t1 = tcg_temp_new_i64(); TCGv_i64 t2 = tcg_temp_new_i64(); @@ -3001,7 +3001,7 @@ static void * const table_##NAME[16] = { \ void tcg_gen_atomic_##NAME##_i32 \ (TCGv_i32 ret, TCGv addr, TCGv_i32 val, TCGArg idx, TCGMemOp memop) \ { \ - if (parallel_cpus) { \ + if (tcg_ctx.tb_cflags & CF_PARALLEL) { \ do_atomic_op_i32(ret, addr, val, idx, memop, table_##NAME); \ } else { \ do_nonatomic_op_i32(ret, addr, val, idx, memop, NEW, \ @@ -3011,7 +3011,7 @@ void tcg_gen_atomic_##NAME##_i32 \ void tcg_gen_atomic_##NAME##_i64 \ (TCGv_i64 ret, TCGv addr, TCGv_i64 val, TCGArg idx, TCGMemOp memop) \ { \ - if (parallel_cpus) { \ + if (tcg_ctx.tb_cflags & CF_PARALLEL) { \ do_atomic_op_i64(ret, addr, val, idx, memop, table_##NAME); \ } else { \ do_nonatomic_op_i64(ret, addr, val, idx, memop, NEW, \