From patchwork Fri Oct 20 23:20:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 116587 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp2244102qgn; Fri, 20 Oct 2017 16:59:18 -0700 (PDT) X-Received: by 10.55.187.199 with SMTP id l190mr9211234qkf.149.1508543958486; Fri, 20 Oct 2017 16:59:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508543958; cv=none; d=google.com; s=arc-20160816; b=qx4+76ujdCCvXvHRun6V0crVvN/ckI9nG033REYFpkaka68nLpGbMm4LVCuL2u64eW 4eTn6UZhkHnrpvqk8ueXyf+rmaP+OII5GiTH+K5i27GNeFImwwEyF5onCKIGIvV+nlhM Xhl7csDAClWkRuXuLqzTRqIIAD5tETOfpsWfuArv+v+QfKGNfLjpUCRslfeMXnk53jGy dbvoFvSeBgP/t14lp7kjrism9uvd1bmLHIxfaxfeI5E855CGOfzrSK0WwvYFaUGolEcM QVvJlqHB//iP7Mk82m4SEfeaDDSD/3iVUycZ8aiAiwoNxp1ux8Q88wg0pfayNy54ejqU lPew== 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=jKIzGmhMwfNcAYttq3MN28iI32Z2MB7lfE7ArYSDxx4=; b=JEbMasXBpOiZiGq69nuXBuYRXmT/1fpEGIEOhjfHPpgY4P64yXL4u9jJwU9iegz0nE 5F7f2YX1I3liFMsqidyM3/PxPpkPIO1htGNOkqAWrK6vx4Af7l7+BxAKyEg9SE21Ip75 WoagkfORTX1x/2vg07nbfN2lUclpm91ds666do+rfDV7PReo6vfyYETUVBAibFqN8Sds l7WwIdlHzN4EJFWsZw8TYC8CInW5n0B/vcCPnbeOjpSusOk07JDi8iPRWxOOqXthQabF gugDHmKoDxTsV6ruwwnrsmeWLS9dqkoEK9VVXsEfFH3YK8M4/xbhPUEgDzP/mlGdTvIm etQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=BG9o7qWS; 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 z4si1718499qkc.336.2017.10.20.16.59.18 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 20 Oct 2017 16:59:18 -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=BG9o7qWS; 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]:56137 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5hC8-0005GT-Aw for patch@linaro.org; Fri, 20 Oct 2017 19:59:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e5gbT-0006SQ-9v for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e5gbQ-0007tZ-68 for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:23 -0400 Received: from mail-pf0-x244.google.com ([2607:f8b0:400e:c00::244]:54003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e5gbQ-0007tF-0f for qemu-devel@nongnu.org; Fri, 20 Oct 2017 19:21:20 -0400 Received: by mail-pf0-x244.google.com with SMTP id t188so13068914pfd.10 for ; Fri, 20 Oct 2017 16:21:19 -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=jKIzGmhMwfNcAYttq3MN28iI32Z2MB7lfE7ArYSDxx4=; b=BG9o7qWSJpECzcrtvznbGNnmWN3/sk4em+pwsY9rGIzMkJsjPLApj75h0ZXmumPJJC Mt3X7vtd6AnFc+xA2Mms2THKmvmtWomT4+owewvVMogwGQnPNeisBsZX94E8Eood/2XC +WgXF0msvhVPJhTKU0m7d8CJQFLvWUs8tijJE= 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=jKIzGmhMwfNcAYttq3MN28iI32Z2MB7lfE7ArYSDxx4=; b=WUOoHyhht+Tic7xMeJVVs49lo6zCoo95yCUd0OfAHp0KSh2Q4ngQbVbPxBbdhLQ7mq js0XkgcovCyB/u5N0IB7QFFsAGgy3mbNyfDXhc8ONOf3OoF3SfeZhKgh4GsmMgaD16i+ e4M9aQ2lE1by8amCoxRLOk9ZjV2hOYySZMsQ82aIxE+zE8WDxSxMpTVBy6HOrsLUQnFd FC+kfGrieSRPFGoReUE7efrMcfNZVKcMFkk5RqIxNvr0Y5GLq+Qsy79cq6G0UwoMxiex G3qPi1mRrBAAjJ8U1D78Qz47jQzZVcXtsPg47dI7EEUyWfk/FM1NN43lyL+ubvkPr7sy T8cw== X-Gm-Message-State: AMCzsaVBsYKOfRwAGhmWqmBusE6Rn8T9delX2XqZXiDWDBQcz3HTHyOp F+5pm5klX8VFqL+VG+z5Ohcux2QbsXY= X-Google-Smtp-Source: ABhQp+RXNiftqra9Uuc/KhUSH/l5ZAoa1cYkRFYpNdIbiYQrnfvX0Y0uPG8Xd/M87qtt+pSoJOyQ0w== X-Received: by 10.84.202.12 with SMTP id w12mr5282041pld.358.1508541678814; Fri, 20 Oct 2017 16:21:18 -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.17 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 20 Oct 2017 16:21:17 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 20 Oct 2017 16:20:08 -0700 Message-Id: <20171020232023.15010-38-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 37/52] 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: pbonzini@redhat.com, cota@braap.org, f4bug@amsat.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. 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 Reviewed-by: Emilio G. Cota 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)) {