From patchwork Wed Oct 25 09:35:20 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 117089 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp661595qgn; Wed, 25 Oct 2017 03:09:55 -0700 (PDT) X-Google-Smtp-Source: ABhQp+SxIB3WEZp9DXCBKez0GWL+5M5iDohA5R3tb37yzcm+via6Q5Zdsp48hmAWThq6VrXMUzQ9 X-Received: by 10.37.246.39 with SMTP id t39mr974541ybd.220.1508926195280; Wed, 25 Oct 2017 03:09:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508926195; cv=none; d=google.com; s=arc-20160816; b=goB/yM1PdNQtvAX2KujkMWDYsUTcz1uqmPLOX4xKsxSrUf+OvuY1jzFhty7D9RPEWz qUCmI9NkPsumIz/NvN9fHYFRB9XVkYum4jLAh8muLlCoDSULEBz8L20y8fHbnR7IbIQ+ Uj+3NieZu4JhnzxUVTsuuwP0HgvaDdBgGSqdufgTNiI4064kpMPPPeZnjWVtC6RFAaHl i+z4tlUb/s6H3QnhPec10VYFon9dgV//1JECmL9sbEtcVrlFAQtQYAxyLzYS4ZceV422 Zd/Y2wqtUle7C7OyGlhOZC1c5p/i4WFy9TWNst4fCcVdUVNot+AwAlvQV6cSxbWlrdzb wHQA== 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=P0EO2WiuwNQl0XbnI+/n61p7/M/Vr6l/Pf84+IDmpPA=; b=GNV35NZF20UG9jUBj9vKqESBnEwqUmUWjtk7LlpQrAFKeRrugUF4i8Fp51R4pv3hF/ 5wyQMO6ySHV+/WzooNVF/+vFHxhuwiQOYGULrY1KkIu6xDyufQ4I2qCy8+J1hEsWe5Vx mZj0D7mVwpsWd5lOyx2m7c7rwpp6qWv7TcepjSl5ktauBFym5fBxLghr5ZJx1qeYg7K3 tZv9GD/T/p+dKq57q31XETYk3mSEnlBbEOoXznWrI+kwdXfdkKICC0c54WIaVwuNYbRX iN7WDN9eia8kQPWRotd52VKHwb2e6ueNFMsLnmkBJvEBWFo8jXDOb8lk4sNYuR7JX++p 2p9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=GdehuoxY; 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 t75si407065ywf.388.2017.10.25.03.09.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 25 Oct 2017 03:09:55 -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=GdehuoxY; 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]:47451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e7IdG-0003J3-O3 for patch@linaro.org; Wed, 25 Oct 2017 06:09:54 -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) 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-Received: by 10.28.58.145 with SMTP id h139mr1099428wma.56.1508924183269; Wed, 25 Oct 2017 02:36:23 -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) 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+patch=linaro.org@nongnu.org Sender: "Qemu-devel" 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(-) -- 2.13.6 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 @@ #include "qemu-common.h" #include "exec/tb-context.h" +#include "sysemu/cpus.h" /* allow to see translation results - the slowdown should be negligible, so we leave it */ #define DEBUG_DISAS @@ -319,13 +320,12 @@ struct TranslationBlock { size <= 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_lock */ -#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); } 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_cycles, TranslationBlock *orig_tb, bool ignore_icount) { TranslationBlock *tb; + uint32_t cflags = curr_cflags() | CF_NOCACHE; + + if (ignore_icount) { + cflags &= ~CF_USE_ICOUNT; + } /* Should never happen. We only end up here when an existing TB is too long. */ - if (max_cycles > CF_COUNT_MASK) - max_cycles = CF_COUNT_MASK; + cflags |= MIN(max_cycles, CF_COUNT_MASK); tb_lock(); - tb = 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 = tb_gen_code(cpu, orig_tb->pc, orig_tb->cs_base, + orig_tb->flags, cflags); tb->orig_tb = orig_tb; tb_unlock(); @@ -229,7 +231,7 @@ void cpu_exec_step_atomic(CPUState *cpu) TranslationBlock *tb; target_ulong cs_base, pc; uint32_t flags; - uint32_t cflags = 1 | CF_IGNORE_ICOUNT; + uint32_t cflags = 1; uint32_t cf_mask = cflags & CF_HASH_MASK; if (sigsetjmp(cpu->jmp_env, 0) == 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(); phys_pc = get_page_addr_code(env, pc); - if (use_icount && !(cflags & CF_IGNORE_ICOUNT)) { - cflags |= CF_USE_ICOUNT; - } tb = tb_alloc(pc); if (unlikely(!tb)) {