From patchwork Fri Oct 20 23:20:05 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116583 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2242014qgn; Fri, 20 Oct 2017 16:55:43 -0700 (PDT) X-Received: by 10.200.24.100 with SMTP id n33mr9676668qtk.307.1508543743539; Fri, 20 Oct 2017 16:55:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508543743; cv=none; d=google.com; s=arc-20160816; b=DlRmKuP4cVJb8WurU13o97yj+LQTSLUgzzD9RiGk5UbIKlObFHvIgtN2tC6S/DayOF +L8y1eoljek0j+TvUPWeyaSsO2F9jFSeK+C5wKeuOiJSR+zxdFt34F5xfZcbi9+QbHpq 4PJ1SgqwDx3c0QpAPXD6v4dYLb8h9hx0JQjJ+mRLkyIREfkgKIiSdBObFoUn0pWQoMkO kvrCgxhyjckNsXlAeQnez1L9ZEO8mnZodOn/xSak0U2EUZedv4jos1TQWHjTx1kPN9en s9j014ucPtF52EwdpHBAhZETk2Vwqn3eC9vd6nUhm+9c58OpGhhmQGcHRg/cDtSofbnH oXEA== 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=i3ZZK4pRYnoUbsBIq5fEktciTSq5nORkc/rLIfC22LM=; b=jw1NUMx3gw/yq6w6tUS3Qr7CaAzSJ9WkzKFqIIYP9B/CGY4SFCeeEh9q38wsLhvLDV uyc64b01BxdP+iVzQp9BSQWGKndfEEv96ITJOf+Zgw3yLPxkWtkZmmXqA7mohHa/XMHK WxXahdniMB5eYorOnkgCwfvD/W13fold7i8fltQbSOkt3+I4hmaZQ4qKNrNKKmPHZ4tR /9r5nBxT+mGymZPuosErldP7O/4Z2NWU9avYNZvz9C8AD9HRybfMBdbG7A7MIkiGbJ44 +ez8TACOcl0497pocEpDz4WFwf6m76vXchGXOMeTLQFKLZ9TTpEfwS7dKxMb4muqEP83 IxVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=Nxp4aPHT; 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 62si1716382qth.150.2017.10.20.16.55.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 20 Oct 2017 16:55:43 -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=Nxp4aPHT; 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]:56125 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5h8f-0002o5-BG for patch@linaro.org; Fri, 20 Oct 2017 19:55:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44632) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5gbQ-0006Pw-EE for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5gbM-0007qZ-8W for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:20 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:50825) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5gbM-0007qG-1X for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:16 -0400 Received: by mail-pf0-x244.google.com with SMTP id b6so13067625pfh.7 for ; Fri, 20 Oct 2017 16:21:15 -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=i3ZZK4pRYnoUbsBIq5fEktciTSq5nORkc/rLIfC22LM=; b=Nxp4aPHTo9Ql+l4sKWGOqtNp5r2pJX2mV8czO83f1xD2ngBVnj5bGfK5nEPdDJn89G HqG7lkeALmZkDi4leEwL4EcTbhwuwCYeOxYIElH4nSRY/tUt2VYwvicpcRYvzGJffl0a t23Pba8dDus/qeWB6FIjrfs97HasejjH6+LVo= 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=i3ZZK4pRYnoUbsBIq5fEktciTSq5nORkc/rLIfC22LM=; b=RC0b3V52BPd3Gr2248sGZ9ibeg9JOrsPfRUI0ZR4gH/AliEWkXPDTZVCxjhsBirj67 PE8HgP05krpx2w31BbWDEBx9i6fjEJA5iNVzrNMlrsh7D2KNsMAs02wFtcUtxjVhknzo 9CN7EZR6Pfb21iaAnAOERfnPhwneAOmygKZXx8GVplyd90MhCied8eIJ5wENIhTuAhwL mVrRucDqqC89seBos5ys+eSuMsKemiUdrk7zWsvS7U8zaarNo4iTpPuQZeSPzt2TDXvg 1XQhMiGlkNhF1uACMeLwD073dseAfYdVgGiqEso35bvQbYU9/AuaoGYw2zB+0tVQV30t RUsA== X-Gm-Message-State: AMCzsaW7SwZV/CIFXOBIA0ymWLu3eW6b8IqikQ8jWKFzbd1is+ww2b1R I3p3LlHBJCssmAv+hDHWjNhiELwgyJE= X-Google-Smtp-Source: ABhQp+QteS3VZcuA7GAqLcJs4LJ4vbtRzl6F+23VleYV6v7sx8IgRiUXekgzbqsQva6m3IqgwqkXcw== X-Received: by 10.99.44.208 with SMTP id s199mr5729654pgs.80.1508541674844; Fri, 20 Oct 2017 16:21:14 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-165-104.tukw.qwest.net. [97.113.165.104]) by smtp.gmail.com with ESMTPSA id a17sm3532594pfk.173.2017.10.20.16.21.13 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2017 16:21:13 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 20 Oct 2017 16:20:05 -0700 Message-Id: <20171020232023.15010-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20171020232023.15010-1-richard.henderson@linaro.org> References: <20171020232023.15010-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:c00::244 Subject: [Qemu-devel] [PATCH v7 34/52] 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: pbonzini@redhat.com, cota@braap.org, f4bug@amsat.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 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 45d0b7c08e..da969eb321 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, \