From patchwork Mon Oct 16 17:25:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 115956 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp3952051qgn; Mon, 16 Oct 2017 10:47:31 -0700 (PDT) X-Received: by 10.55.82.86 with SMTP id g83mr14719668qkb.342.1508176051095; Mon, 16 Oct 2017 10:47:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508176051; cv=none; d=google.com; s=arc-20160816; b=KYzPkitVddkZsIND8PFBDBjF64ln3YBpy7o3krxf09m6mMgtcabhexCePhgMrUsZFN RiBiZVy21KIwi+PnKgOzwZwfxGEqV+c3cTtlRE46aDm98/yDzjqNI5OePQQRQuTKjMPy TnStcGz0EK/VCqjyqooUQh2jvWCZmJzKUgl4mECzvAeTn5BrNNxBdYJD35URiPJqv+N0 G+/ak6pEt6N9eGRV3UhhIVoX2GzWFm3MyvdqOKMwv10SsEE9UFD1/XtxkFR3Tjxv0lWW 6p3w1MqyPLc3OMLYYfgFv5avEwyhS7chdxlVAk/1M5dmSMXklHkexpTcoKsvULBiG9C9 SlvQ== 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=rNneEMePZmh2n3MgU+clGSMraZtaGE+TiRXzcHouM8E=; b=HRdZ9ROPHu4FYzQm/hOVWLgUYEIhWLXao3XyybQ7bmK8IT4V0lLBaWEf0H2DPvlGn9 jSax6SJy6ECCuke8s+xyIYDAyxiQx5RJR7te6UuMJGBVlrSGtfJ1gdmt4h/Ktp6Ejo96 u7dkp3d3Ur/Uy+D8RzHiesrq/w81e55oMbahcxPc85eQ1RyMgtmNdiIWPN4280FbA7Wd JWEKaMFh9dDXpWS3rJQZDMyqRJQF35+u3Be86SHU9+JmCAjuQ4PahCqh+49v7quUUkF9 3IY+kakqIGmC7eb/zkfPVOYT29TTUIGXP79l8y2HjhM+azNCjazX6UaswMYMrNAxg0p+ usPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=KpT6/9sw; 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 i22si480258qkh.292.2017.10.16.10.47.30 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 16 Oct 2017 10:47:31 -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=KpT6/9sw; 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]:34380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e49U8-0002r5-QI for patch@linaro.org; Mon, 16 Oct 2017 13:47:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52678) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e49AS-0002ik-IQ for qemu-devel@nongnu.org; Mon, 16 Oct 2017 13:27:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e49AM-0003og-KV for qemu-devel@nongnu.org; Mon, 16 Oct 2017 13:27:08 -0400 Received: from mail-pg0-x232.google.com ([2607:f8b0:400e:c05::232]:47624) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e49AM-0003nm-Ep for qemu-devel@nongnu.org; Mon, 16 Oct 2017 13:27:02 -0400 Received: by mail-pg0-x232.google.com with SMTP id r25so7349314pgn.4 for ; Mon, 16 Oct 2017 10:27:02 -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=rNneEMePZmh2n3MgU+clGSMraZtaGE+TiRXzcHouM8E=; b=KpT6/9swbCbXrI2IV0xjjoIuCYiFe6cP57GAz/iOBniN65YI3c2Y4lukI8tsDynkpV HRuOjk0MPl+0zC9MuIbZC99Ii/JcGLqalIYsoY9cQdhN0GRHYF4z31ZyyAOXO1TAQheI p0YjlVqsF3jBGWNb233E1ELmRZVmt1IJJEWto= 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=rNneEMePZmh2n3MgU+clGSMraZtaGE+TiRXzcHouM8E=; b=O3W3UjXNePTbooNa2Dbz1SJFsfYMTPpDXhbGU7sM840dJPojkkOECcv24TVRExi8sK 75jj10mKzn6ichy0iK9GwH+hMQozd1eMoqCMkFXIvGv7mWOaMepJ3IulvQFhVlR/RTK5 7ZVSC1bg9zOPB+D9xBCnKfgaAEvBxMBAhqqWzet7MXVl6ze4HrTuCMUR+43ExlceZ4l+ 6EfWdFSMbJ8B+avnMfX1DxTbv8+ir1IXF+LqtHmaETNZ+uWxQXZnLBJ4dqaYBidGZBtj 1pBjFEd+XCOVTsNL1t6u12IGPO0kqoRQAWXHISWE2krwT7L9qA+TA/cs+RMkOs82uWhm Nq/g== X-Gm-Message-State: AMCzsaVs+/kfH7Xl4J/KVgyliQPZPOkwMXzVoXXAVUvyhXMHfamwEeUD hdrMkouTwaib1KcTcbuceL5+TimP0MM= X-Google-Smtp-Source: AOwi7QDAmAiDZFzGxQQlqihhAVz8CKgiRNQ95VzhrNx1EJON2Pp8ZbdLj0HVG5qm2FO1QMuuok/bkg== X-Received: by 10.84.210.166 with SMTP id a35mr9719602pli.426.1508174821230; Mon, 16 Oct 2017 10:27:01 -0700 (PDT) Received: from cloudburst.twiddle.net (97-126-104-76.tukw.qwest.net. [97.126.104.76]) by smtp.gmail.com with ESMTPSA id i187sm5594249pfc.96.2017.10.16.10.26.59 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 16 Oct 2017 10:27:00 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 16 Oct 2017 10:25:53 -0700 Message-Id: <20171016172609.23422-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171016172609.23422-1-richard.henderson@linaro.org> References: <20171016172609.23422-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c05::232 Subject: [Qemu-devel] [PATCH v6 34/50] 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: cota@braap.org 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 --- 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 5e1170b299..6736a9fe2e 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -656,6 +656,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 a7415c8661..d3dee985b4 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 be4b623e82..3253451115 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, \