From nobody Tue Feb 10 07:22:25 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1508926199191420.02113293719276; Wed, 25 Oct 2017 03:09:59 -0700 (PDT) Received: from localhost ([::1]:47451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7IdA-0003J3-2D for importer@patchew.org; Wed, 25 Oct 2017 06:09:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45972) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7I6v-0000FC-3e for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:36:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e7I6q-00006J-Mv for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:36:29 -0400 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:50354) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e7I6q-00005l-GS for qemu-devel@nongnu.org; Wed, 25 Oct 2017 05:36:24 -0400 Received: by mail-wm0-x243.google.com with SMTP id u138so597134wmu.5 for ; Wed, 25 Oct 2017 02:36:24 -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.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 25 Oct 2017 02:36:22 -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=P0EO2WiuwNQl0XbnI+/n61p7/M/Vr6l/Pf84+IDmpPA=; b=GdehuoxYqViUZhFz7Cx9zEEqV0pg42MJ1mnu1oNsWbprVn0JhPyvH01w5/TDJV+rIM DawJuOgHL8YGHe7bIU/xi3hVWXwT1o8NGrB6YRNFH6VTV3x5dJnMdlWjYHyLxAauYDBi 6dYsYr459gs6u4UmSK0QTyHa4atitppZVXd0I= 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=P0EO2WiuwNQl0XbnI+/n61p7/M/Vr6l/Pf84+IDmpPA=; b=FwoZA/mppv/HudozUf88PYvnku1dqDJH/a0fYW9KI3hc1jHySYngwjyBNXX3tcbRIA qNPL9XnxCyT+EVQN1RlKsFJL9X86xbuFrnp/5fwviF7vbVj8sVhLah28/GW23aBz67c2 hrWkYUv8PYehRX4Qva9xLuO1fpyDK7AqmVBLLBe4JUvhkYKnbyrJ8kPv0Fo06blJcUrx FJQJn763gWlqRfbwm63uSovrHWUzd7f0xZLZFZu/aVWiBazhpoIr9ccVsLDGkYTwYO4Y 9l5zYPOnP/sf6VWKvl053R2ioqPO+MutxusWG8Gb5jnXcFq6pjNdOBD7yPPsJQVt+OMo qz2A== X-Gm-Message-State: AMCzsaX6w0WrZAHFJ1XLSlLXET4y+fXkIZPfU0zf6Vtx6eLJRAF7L/3P CVl7OyXo9tBQCQfF5jSv6dhhAcYkk7I= X-Google-Smtp-Source: ABhQp+S7D84LWOSq1DHNXmDm0NDULspXkb2CscV/1MMdX3IlWOt+4eWA62TcW/AVIPEmDtIz0+StJg== X-Received: by 10.28.58.145 with SMTP id h139mr1099428wma.56.1508924183269; Wed, 25 Oct 2017 02:36:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 25 Oct 2017 11:35:20 +0200 Message-Id: <20171025093535.10175-37-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::243 Subject: [Qemu-devel] [PULL 36/51] tcg: Remove CF_IGNORE_ICOUNT 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 Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now that we have curr_cflags, we can include CF_USE_ICOUNT early and then remove it as necessary. Reviewed-by: Emilio G. Cota Signed-off-by: Richard Henderson --- include/exec/exec-all.h | 17 +++++++++-------- accel/tcg/cpu-exec.c | 16 +++++++++------- accel/tcg/translate-all.c | 3 --- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index a3bd3e7abd..f14c6a56eb 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -22,6 +22,7 @@ =20 #include "qemu-common.h" #include "exec/tb-context.h" +#include "sysemu/cpus.h" =20 /* allow to see translation results - the slowdown should be negligible, s= o we leave it */ #define DEBUG_DISAS @@ -319,13 +320,12 @@ struct TranslationBlock { size <=3D TARGET_PAGE_SIZE) */ uint16_t icount; uint32_t cflags; /* compile flags */ -#define CF_COUNT_MASK 0x7fff -#define CF_LAST_IO 0x8000 /* Last insn may be an IO access. */ -#define CF_NOCACHE 0x10000 /* To be freed after execution */ -#define CF_USE_ICOUNT 0x20000 -#define CF_IGNORE_ICOUNT 0x40000 /* Do not generate icount code */ -#define CF_INVALID 0x80000 /* TB is stale. Setters must acquire tb_loc= k */ -#define CF_PARALLEL 0x100000 /* Generate code for a parallel context */ +#define CF_COUNT_MASK 0x00007fff +#define CF_LAST_IO 0x00008000 /* Last insn may be an IO access. */ +#define CF_NOCACHE 0x00010000 /* To be freed after execution */ +#define CF_USE_ICOUNT 0x00020000 +#define CF_INVALID 0x00040000 /* TB is stale. Setters need tb_lock */ +#define CF_PARALLEL 0x00080000 /* Generate code for a parallel context = */ /* cflags' mask for hashing/comparison */ #define CF_HASH_MASK \ (CF_COUNT_MASK | CF_LAST_IO | CF_USE_ICOUNT | CF_PARALLEL) @@ -380,7 +380,8 @@ static inline uint32_t tb_cflags(const TranslationBlock= *tb) /* current cflags for hashing/comparison */ static inline uint32_t curr_cflags(void) { - return parallel_cpus ? CF_PARALLEL : 0; + return (parallel_cpus ? CF_PARALLEL : 0) + | (use_icount ? CF_USE_ICOUNT : 0); } =20 void tb_free(TranslationBlock *tb); diff --git a/accel/tcg/cpu-exec.c b/accel/tcg/cpu-exec.c index 849b54d0b0..b44c7941aa 100644 --- a/accel/tcg/cpu-exec.c +++ b/accel/tcg/cpu-exec.c @@ -198,17 +198,19 @@ static void cpu_exec_nocache(CPUState *cpu, int max_c= ycles, TranslationBlock *orig_tb, bool ignore_icount) { TranslationBlock *tb; + uint32_t cflags =3D curr_cflags() | CF_NOCACHE; + + if (ignore_icount) { + cflags &=3D ~CF_USE_ICOUNT; + } =20 /* Should never happen. We only end up here when an existing TB is too long. */ - if (max_cycles > CF_COUNT_MASK) - max_cycles =3D CF_COUNT_MASK; + cflags |=3D MIN(max_cycles, CF_COUNT_MASK); =20 tb_lock(); - tb =3D tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, orig_tb->flags, - max_cycles | CF_NOCACHE - | (ignore_icount ? CF_IGNORE_ICOUNT : 0) - | curr_cflags()); + tb =3D tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, + orig_tb->flags, cflags); tb->orig_tb =3D orig_tb; tb_unlock(); =20 @@ -229,7 +231,7 @@ void cpu_exec_step_atomic(CPUState *cpu) TranslationBlock *tb; target_ulong cs_base, pc; uint32_t flags; - uint32_t cflags =3D 1 | CF_IGNORE_ICOUNT; + uint32_t cflags =3D 1; uint32_t cf_mask =3D cflags & CF_HASH_MASK; =20 if (sigsetjmp(cpu->jmp_env, 0) =3D=3D 0) { diff --git a/accel/tcg/translate-all.c b/accel/tcg/translate-all.c index dcd47cd692..9fa94340dd 100644 --- a/accel/tcg/translate-all.c +++ b/accel/tcg/translate-all.c @@ -1274,9 +1274,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, assert_memory_lock(); =20 phys_pc =3D get_page_addr_code(env, pc); - if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) { - cflags |=3D CF_USE_ICOUNT; - } =20 tb =3D tb_alloc(pc); if (unlikely(!tb)) { --=20 2.13.6