From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493106980690587.1545488413167; Tue, 25 Apr 2017 00:56:20 -0700 (PDT) Received: from localhost ([::1]:47564 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vKc-0001IB-U2 for importer@patchew.org; Tue, 25 Apr 2017 03:56:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33753) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIf-0008FW-JQ for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIe-0000j9-KG for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:17 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:33729) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIc-0000f9-4R; Tue, 25 Apr 2017 03:54:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8109421F1D; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:03 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 386BE7E43A; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=UOv 20f+l1GAVhovfE4nm/88IpJJkIuWQxnw7tUCAEms=; b=v2M1NfeX/ashrxWTtaN I5D7nq/rCz6T3ENn8W80xZqvwrs4hlOXvMxTjltL3vLb/7gVwzYQlDI8M7ePBvhT YPBLGM70pqTgLwzF/s+jJWm83smZxPfj19XPSDpECG96v8wUPeR9aAtxwLhmxmb0 hY1bJvBPvjRMsyF+5PVg8O1c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=UOv20f+l1GAVhovfE4nm/88IpJJkIuWQxnw7tUCAE ms=; b=Afh44ijy/u5TMlhmNMCbf3GPKEIwXaxJXL/s+zYWLHHlBil3Cyi5cDt2Z CXm3VWrXVKK4CMXdR/HgIOFEqBF9L+5Odth7yW1VQc+lq7inyzho0tMEpbfJfIK9 Qg6WSXDK48VPeoVunzov8HSkQdvqwONu5Ei4SQrYnGpqjr+TG9vbTq1E7vcOsBZI Fkwk9anQY316y0NM5sUUjeGR9eg4/sX7V2ucYNJx8AYDSuYwjspd86QaP7pRQeB+ MdBCx2HG4TMRVvmG6mvco65Pahcp/qiz2FlR+EJ+LE0bTadW91Fcz4pbflt5JeIz c1+SYEnZOkgZVxlom1gMyEACBc8Zg== X-ME-Sender: X-Sasl-enc: ePeeqD7T8sZF3WOmvFafcqyZu2z64H3tf2JaKdSpLtfA 1493106843 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:47 -0400 Message-Id: <1493106839-10438-2-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 01/13] exec-all: add tb_from_jmp_cache 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This paves the way for upcoming changes. Signed-off-by: Emilio G. Cota --- cpu-exec.c | 19 +++++++++++++++++++ include/exec/exec-all.h | 2 +- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cpu-exec.c b/cpu-exec.c index 63a56d0..b4adf16 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -309,6 +309,25 @@ static bool tb_cmp(const void *p, const void *d) return false; } =20 +TranslationBlock *tb_from_jmp_cache(CPUArchState *env, target_ulong vaddr) +{ + CPUState *cpu =3D ENV_GET_CPU(env); + TranslationBlock *tb; + target_ulong cs_base, pc; + uint32_t flags; + + if (unlikely(atomic_read(&cpu->exit_request))) { + return NULL; + } + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(vaddr= )]); + if (likely(tb && tb->pc =3D=3D vaddr && tb->cs_base =3D=3D cs_base && + tb->flags =3D=3D flags)) { + return tb; + } + return NULL; +} + static TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, target_ulong cs_base, diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index bcde1e6..18b80bc 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -56,7 +56,6 @@ TranslationBlock *tb_gen_code(CPUState *cpu, target_ulong pc, target_ulong cs_base, uint32_t flags, int cflags); - void QEMU_NORETURN cpu_loop_exit(CPUState *cpu); void QEMU_NORETURN cpu_loop_exit_restore(CPUState *cpu, uintptr_t pc); void QEMU_NORETURN cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc); @@ -368,6 +367,7 @@ struct TranslationBlock { void tb_free(TranslationBlock *tb); void tb_flush(CPUState *cpu); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); +TranslationBlock *tb_from_jmp_cache(CPUArchState *env, target_ulong vaddr); =20 #if defined(USE_DIRECT_JUMP) =20 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493106982216335.49144111438136; Tue, 25 Apr 2017 00:56:22 -0700 (PDT) Received: from localhost ([::1]:47565 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vKe-0001Iu-4x for importer@patchew.org; Tue, 25 Apr 2017 03:56:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33771) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIg-0008Fp-4P for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIf-0000ji-2Z for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:18 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:35991) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIc-0000fB-Cf; Tue, 25 Apr 2017 03:54:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id E873821F1F; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:03 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 7A76E24811; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=7Tv sDZZBFRCz/sC2wkCjfkLkAMw2jfzmseFj4+YhzrE=; b=kjieIErS6qZA1jKaRHk Q4rso3YrQpWvohMrVLRhEVyL4MyBvqj2gPDSUkSvqGcOw2EiJB3ncN0oVGayPDsM 2HnSUSQdRiJyQqxKkDqyUcNWIZbv4mgV4seG/8HPHZlyb1fDmE7edS6ZL9Ac9/pK ZxaH8rm7xzcoM0yYVF/ICV2U= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=7TvsDZZBFRCz/sC2wkCjfkLkAMw2jfzmseFj4+Yhz rE=; b=giPtF4EkA/VvRYwDxlrGlcLeSxtqfSOcXhjrkpuTQEhOS4TGr86VzbBNh SMOfDBv3NFpM7QraTryLQIhEli3mgm1uhmKQ+0tCElzfNaZldqYy2q/VefCSveW8 RLLVdH8XSR8LqktVO76eLl9PpHaQikIe2LyTcItTHG7TnqOGmaD3Zvgk4TNI/6Cw cm53vKs4Bo1TQ1//HU9fc3USZW9MCx8Obh5gk9OdX2JiyiWa/SeOWpGuTtuZBljo FtivdjoGyn05KTfuaUwDZuMbxbN/ESNtYLlIKV1+/D7BFWKi6hlzqHKiuHv+KTf5 xxR4dWpdLhgUOewwzoBPN3G/snrbw== X-ME-Sender: X-Sasl-enc: ePeerizF/sFc03+8skmfcqyZu2z64H3tf2JaKdSpLtfA 1493106843 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:48 -0400 Message-Id: <1493106839-10438-3-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 02/13] exec-all: inline tb_from_jmp_cache 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The inline improves performance, as shown in upcoming commits' logs. This commit is kept separate to ease review, since the inclusion of tb-hash.h might be controversial. The problem here, which was introduced before this commit, is that tb_hash_func() depends on page_addr_t: this defeats the original purpose of tb-hash.h, which was to be self-contained and CPU-agnostic. Signed-off-by: Emilio G. Cota --- cpu-exec.c | 19 ------------------- include/exec/exec-all.h | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index b4adf16..63a56d0 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -309,25 +309,6 @@ static bool tb_cmp(const void *p, const void *d) return false; } =20 -TranslationBlock *tb_from_jmp_cache(CPUArchState *env, target_ulong vaddr) -{ - CPUState *cpu =3D ENV_GET_CPU(env); - TranslationBlock *tb; - target_ulong cs_base, pc; - uint32_t flags; - - if (unlikely(atomic_read(&cpu->exit_request))) { - return NULL; - } - cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); - tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(vaddr= )]); - if (likely(tb && tb->pc =3D=3D vaddr && tb->cs_base =3D=3D cs_base && - tb->flags =3D=3D flags)) { - return tb; - } - return NULL; -} - static TranslationBlock *tb_htable_lookup(CPUState *cpu, target_ulong pc, target_ulong cs_base, diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 18b80bc..bd76987 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -367,7 +367,29 @@ struct TranslationBlock { void tb_free(TranslationBlock *tb); void tb_flush(CPUState *cpu); void tb_phys_invalidate(TranslationBlock *tb, tb_page_addr_t page_addr); -TranslationBlock *tb_from_jmp_cache(CPUArchState *env, target_ulong vaddr); + +/* tb_hash_func() in tb-hash.h needs tb_page_addr_t, defined above */ +#include "tb-hash.h" + +static inline +TranslationBlock *tb_from_jmp_cache(CPUArchState *env, target_ulong vaddr) +{ + CPUState *cpu =3D ENV_GET_CPU(env); + TranslationBlock *tb; + target_ulong cs_base, pc; + uint32_t flags; + + if (unlikely(atomic_read(&cpu->exit_request))) { + return NULL; + } + cpu_get_tb_cpu_state(env, &pc, &cs_base, &flags); + tb =3D atomic_rcu_read(&cpu->tb_jmp_cache[tb_jmp_cache_hash_func(vaddr= )]); + if (likely(tb && tb->pc =3D=3D vaddr && tb->cs_base =3D=3D cs_base && + tb->flags =3D=3D flags)) { + return tb; + } + return NULL; +} =20 #if defined(USE_DIRECT_JUMP) =20 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493106993320568.6651922332512; Tue, 25 Apr 2017 00:56:33 -0700 (PDT) Received: from localhost ([::1]:47566 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vKq-0001Uh-1F for importer@patchew.org; Tue, 25 Apr 2017 03:56:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33746) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIf-0008FB-Aq for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIe-0000iw-IW for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:17 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:41085) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIZ-0000fC-Mu; Tue, 25 Apr 2017 03:54:12 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id F0E2121F25; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:03 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B00027E7A2; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=api 3sjPXzyP7+xh0OFgAe0egor5sVk45hJf7nyGr+ps=; b=aIL2rF1NBFWim09DZYb dBa6W0+xBhPn4Ws2YXfEcGprFPIlrTv84zMtr9Q8HzFxhMfdAiaKEjCewGrFxh4X 0k234iCd5DYvx/xLdnfa+g7awJvbN2F4Ty9q5e8rhh4aaxiy1dEj1woqvuDt5o/C kVJiqaZ9re/WBo0GE12NYiSM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=api3sjPXzyP7+xh0OFgAe0egor5sVk45hJf7nyGr+ ps=; b=kFj2A0hoeOMVbPFOIKEPPFSA2x175pL5QWfN3BfkxGYU6quQEfBiVdmyD leYyxquxAOH8YbgS69Fc62Iw40OzW6TMkrmw+b8UeTgzCyJoNPkUzWkkWKMFDKLp 3NWx4HQ3JRyTAY4+A5YdamrQ7N8q4ZDM2RhmQ6M+y/cg60oDodWsLDwAzHOlYm8E I/6wFCNr7cJhn3o66A2phJAycFRdV9EEcd13vXe3V3IveoRPMdE+joy8L+boCQI1 0Jw08eL5rOGBxcSaQgEa1RgbDHxVWKqJ2Otdyn+wXn+97MTGGDE5LbnTogsEmE9z +8p23VCukUF3jPpQ39qk2iFxLy6EQ== X-ME-Sender: X-Sasl-enc: ePeDty/F/chD3XayqVefcqyZu2z64H3tf2JaKdSpLtfA 1493106843 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:49 -0400 Message-Id: <1493106839-10438-4-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 03/13] tcg: enforce 64-byte alignment of TCGContext 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This will allow us to prevent cache line false sharing in TCGContext. Before: $ objdump -t build/x86_64-linux-user/qemu-x86_64 | grep tcg_ctx 00000000003ea820 g O .bss 00000000000152d8 tcg_ctx After: $ objdump -t build/x86_64-linux-user/qemu-x86_64 | grep tcg_ctx 00000000003ea880 g O .bss 0000000000015300 tcg_ctx Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index 6c216bb..5fdbfe3 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -727,7 +727,7 @@ struct TCGContext { =20 uint16_t gen_insn_end_off[TCG_MAX_INSNS]; target_ulong gen_insn_data[TCG_MAX_INSNS][TARGET_INSN_START_WORDS]; -}; +} QEMU_ALIGNED(64); =20 extern TCGContext tcg_ctx; extern bool parallel_cpus; --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107694725981.7210439788561; Tue, 25 Apr 2017 01:08:14 -0700 (PDT) Received: from localhost ([::1]:47642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vW9-0002dO-1A for importer@patchew.org; Tue, 25 Apr 2017 04:08:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIs-0008VN-Om for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000p2-FJ for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:30 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:52847) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000gR-Hk; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 155F921F26; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id EFF7C24813; Tue, 25 Apr 2017 03:54:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=oIt 0v33rjciqAFSJM93+0ftvaG8TKg4ll7wOGlGSNZQ=; b=PfraxVjt0UDKcJJ8D35 JKup4jJAqMjj+g3TDbqKSgk+9PCSqqLLv5i2aNoxQK3q0dJjm/+CxOoR/slJc4XS WaKpUFWhLpQu1o4gFTOhAE+tGpeZSgdWHO6aXbwzffLmB6KwSOBdgE1Iy++5dVYp jqpK+VcIJcBs4p34HLY8/JOY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=oIt0v33rjciqAFSJM93+0ftvaG8TKg4ll7wOGlGSN ZQ=; b=Knyd06QGzGPJNa62VQdYUCw8qedzlhoZDsVntXdoq3yWiRGQU97pj7TVv ogdHFZmfMLETVztpbILIlfVi7y236WZHJd98BLKwjY7DNsH9XPaR+qFQuAeiNhFm fZ/r+UBdffDlzQQz4Gb19Hp7nA0vYhJwxsBg27Szmk99FuhXXIejCCOslqLat/Ro sjXWRb5kTX7BniWx0U2r1PTYI/xnVqjLo5ZWvIkOFCK0IGwG6yWFhuGzCuGESTKF hmul+WUVh7IywhQD4asAf5Snhypc4FbWDEoc1kACEIy03C9WIur2qTAtubJDmaQM aAGrEemB6MouNcG7d78IfSR5FXiyA== X-ME-Sender: X-Sasl-enc: McDoeZoQNtvikGtwzThR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:50 -0400 Message-Id: <1493106839-10438-5-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 04/13] tcg: keep TCGContext's read-mostly fields in a separate cache line 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Upcoming changes will require reading from TCGContext from a parallel fast path. Prepare for this by keeping the struct's read-mostly fields in a separate cache line, thereby preventing false cache line sharing. Signed-off-by: Emilio G. Cota --- tcg/tcg.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/tcg/tcg.h b/tcg/tcg.h index 5fdbfe3..b26f0ef 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -642,6 +642,20 @@ QEMU_BUILD_BUG_ON(OPPARAM_BUF_SIZE > (1 << 14)); QEMU_BUILD_BUG_ON(sizeof(TCGOp) > 8); =20 struct TCGContext { + /* Read-mostly fields go here to prevent false sharing */ + struct { + GHashTable *helpers; + + void *code_gen_prologue; + void *code_gen_buffer; + size_t code_gen_buffer_size; + + /* Threshold to flush the translated code buffer. */ + void *code_gen_highwater; + + int code_gen_max_blocks; + } QEMU_ALIGNED(64); + uint8_t *pool_cur, *pool_end; TCGPool *pool_first, *pool_current, *pool_first_large; int nb_labels; @@ -663,8 +677,6 @@ struct TCGContext { =20 tcg_insn_unit *code_ptr; =20 - GHashTable *helpers; - #ifdef CONFIG_PROFILER /* profiling info */ int64_t tb_count1; @@ -697,15 +709,8 @@ struct TCGContext { here, because there's too much arithmetic throughout that relies on addition and subtraction working on bytes. Rely on the GCC extension that allows arithmetic on void*. */ - int code_gen_max_blocks; - void *code_gen_prologue; - void *code_gen_buffer; - size_t code_gen_buffer_size; void *code_gen_ptr; =20 - /* Threshold to flush the translated code buffer. */ - void *code_gen_highwater; - TBContext tb_ctx; =20 /* Track which vCPU triggers events */ --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107309551857.3271613885579; Tue, 25 Apr 2017 01:01:49 -0700 (PDT) Received: from localhost ([::1]:47606 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vPw-000659-6A for importer@patchew.org; Tue, 25 Apr 2017 04:01:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIp-0008Qs-Up for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pQ-Tw for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:33111) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000gQ-IM; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1561821F27; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 3010F7E0EE; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=Jix Jy7yYijVMjf62Jc70ezCslLHadK66n72hzWnGTts=; b=fWQsJTpqYth6QiLjTu4 4jP2ljKdIRLQuoH+8vVTeV9uWSSp6e/GTAZf2Scy+RGhLy6rq/vkJJNiyzd1uWZ3 hjRbJH2uMclqBWuMF4ivoAWeYv8Wxk8YOrjFsIhsY2PXOQ3gR84uoumDj3lc5ASi jESMIj/nXJdWHprb0N+Yqedw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=JixJy7yYijVMjf62Jc70ezCslLHadK66n72hzWnGT ts=; b=JFNdzMdE14Lgl0jC7KAlU+X/mNmL4bDs3wzBILYPMFeuTchH6T9tjgcTh w0DEy2WEq5m4do8snNWKa1Vn0aKKaZORKeYmHQ4oNOmHAgotPXK7GnAZUwSWlRif bFX+rt/+aXsGZE+oZlRFC1N9MVHXS+mEoEvrjQK48yMMvbDO9lVmudVSYOmIqLui /kwSvUO/YQhpv5aTPAjwPxaoRJRQWJCy/HIEoDgkl4U7d2jQ3lc9UH69DgjRKcLJ RlDe/fafQwH5684TJzK6LOl9SRJPWBu/upx6ZcEXI1Qv5XtCYBA+Kh3F9CxO4Iub JYwHILI7/EUf/StlJjkfQVo3uQKIw== X-ME-Sender: X-Sasl-enc: McD5e5gLPM3vm2Z62yNR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:51 -0400 Message-Id: <1493106839-10438-6-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 05/13] tcg-runtime: add lookup_tb_ptr helper 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- tcg-runtime.c | 7 +++++++ tcg/tcg-runtime.h | 2 ++ tcg/tcg.h | 1 + 3 files changed, 10 insertions(+) diff --git a/tcg-runtime.c b/tcg-runtime.c index 4c60c96..f291184 100644 --- a/tcg-runtime.c +++ b/tcg-runtime.c @@ -141,6 +141,13 @@ uint64_t HELPER(ctpop_i64)(uint64_t arg) return ctpop64(arg); } =20 +void *HELPER(lookup_tb_ptr)(CPUArchState *env, target_ulong addr) +{ + TranslationBlock *tb =3D tb_from_jmp_cache(env, addr); + + return tb ? tb->tc_ptr : tcg_ctx.code_gen_epilogue; +} + void HELPER(exit_atomic)(CPUArchState *env) { cpu_loop_exit_atomic(ENV_GET_CPU(env), GETPC()); diff --git a/tcg/tcg-runtime.h b/tcg/tcg-runtime.h index 114ea6f..c41d38a 100644 --- a/tcg/tcg-runtime.h +++ b/tcg/tcg-runtime.h @@ -24,6 +24,8 @@ DEF_HELPER_FLAGS_1(clrsb_i64, TCG_CALL_NO_RWG_SE, i64, i6= 4) DEF_HELPER_FLAGS_1(ctpop_i32, TCG_CALL_NO_RWG_SE, i32, i32) DEF_HELPER_FLAGS_1(ctpop_i64, TCG_CALL_NO_RWG_SE, i64, i64) =20 +DEF_HELPER_FLAGS_2(lookup_tb_ptr, TCG_CALL_NO_WG_SE, ptr, env, tl) + DEF_HELPER_FLAGS_1(exit_atomic, TCG_CALL_NO_WG, noreturn, env) =20 #ifdef CONFIG_SOFTMMU diff --git a/tcg/tcg.h b/tcg/tcg.h index b26f0ef..625e2aa 100644 --- a/tcg/tcg.h +++ b/tcg/tcg.h @@ -647,6 +647,7 @@ struct TCGContext { GHashTable *helpers; =20 void *code_gen_prologue; + void *code_gen_epilogue; void *code_gen_buffer; size_t code_gen_buffer_size; =20 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107490109650.1219635328669; Tue, 25 Apr 2017 01:04:50 -0700 (PDT) Received: from localhost ([::1]:47621 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vSq-0000B9-Uj for importer@patchew.org; Tue, 25 Apr 2017 04:04:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33998) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIq-0008Ru-DW for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pV-Vu for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:57589) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hA-Hx; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1572321F29; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 563BB2479D; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=QVh YawXFcUi8j51QvHUGX9ciyL8i1T4rMyHNPFzXajU=; b=elZBUVy/8/fR5pQRfKV oOJyWf7uFR8bQSM2tVRbJrPnFSSkTRYyt6n1X4ibEoG5R++fBMNP84DFJWGveybp xJd5aZ5QkLIEFlGxhiDmLrD66X6DFjQDjZBLr2mRlmttvh8lG1P5YlJAIoMFDx4H 4VJgPzVP4ZPJl6N2QTfoqiUU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=QVhYawXFcUi8j51QvHUGX9ciyL8i1T4rMyHNPFzXa jU=; b=igjzmFXd8Et9DV5kC4Y8KkYE201ZuCS91+a0MFdNsDOFsNIevNr7KGlmU sOG6N1XsYcPl5KhSHq9uo6Z1S4UvNFosGyDAc09Q+eNTcjnKkInQg8dCQIbdjI+7 HiYDDjPeAhs5TDkKTNVPDZUzEnkssX45jsbIPmW+5bm+U8gCyNEqz6+HGvfoUG03 1wWSzm6F1zcYjuBLQvF8rGxaxRWuNER1Zu2jhk83mtDVCt6PyCyJib+uEumVBKCh KsPmYfNCe+E9k39wuWmPsE8U0JGx5NSv6ibkOZh9Vlrnjg/ATiXRs3yzFkvtwwDy cJhVYW7HLMRb2IB1CJMlF3Afn3bIA== X-ME-Sender: X-Sasl-enc: McDwcYoSOsrgn35+xydR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:52 -0400 Message-Id: <1493106839-10438-7-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 06/13] tcg: add goto_ptr opcode 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Emilio G. Cota --- tcg/README | 11 +++++++++++ tcg/aarch64/tcg-target.h | 1 + tcg/arm/tcg-target.h | 1 + tcg/i386/tcg-target.h | 1 + tcg/ia64/tcg-target.h | 1 + tcg/mips/tcg-target.h | 1 + tcg/ppc/tcg-target.h | 1 + tcg/s390/tcg-target.h | 1 + tcg/sparc/tcg-target.h | 1 + tcg/tcg-op.c | 9 +++++++++ tcg/tcg-op.h | 9 +++++++++ tcg/tcg-opc.h | 1 + tcg/tcg.c | 1 + tcg/tci/tcg-target.h | 1 + 14 files changed, 40 insertions(+) diff --git a/tcg/README b/tcg/README index a9858c2..9cfd422 100644 --- a/tcg/README +++ b/tcg/README @@ -477,6 +477,17 @@ current TB was linked to this TB. Otherwise execute th= e next instructions. Only indices 0 and 1 are valid and tcg_gen_goto_tb may be is= sued at most once with each slot index per TB. =20 +* goto_ptr ptr + +Jump to a host address given by host pointer 'ptr'. Typically ptr is obta= ined +from the lookup_tb_ptr TCG helper. The return value of this helper depends= on +whether the TB is currently valid: if it is, the corresponding host address +is returned; if it is not valid, the helper returns the address of the TCG +epilogue, which restores state to go back to the exec loop. + +Implementing goto_ptr is optional for TCG backends. When not implemented, +calling it is equivalent to calling exit_tb(0). + * qemu_ld_i32/i64 t0, t1, flags, memidx * qemu_st_i32/i64 t0, t1, flags, memidx =20 diff --git a/tcg/aarch64/tcg-target.h b/tcg/aarch64/tcg-target.h index 1a5ea23..b82eac4 100644 --- a/tcg/aarch64/tcg-target.h +++ b/tcg/aarch64/tcg-target.h @@ -77,6 +77,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_div_i64 1 #define TCG_TARGET_HAS_rem_i64 1 diff --git a/tcg/arm/tcg-target.h b/tcg/arm/tcg-target.h index 09a19c6..2f3ecfd 100644 --- a/tcg/arm/tcg-target.h +++ b/tcg/arm/tcg-target.h @@ -123,6 +123,7 @@ extern bool use_idiv_instructions; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_div_i32 use_idiv_instructions #define TCG_TARGET_HAS_rem_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 enum { TCG_AREG0 =3D TCG_REG_R6, diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 4275787..59d9835 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,6 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/ia64/tcg-target.h b/tcg/ia64/tcg-target.h index 42aea03..901bb75 100644 --- a/tcg/ia64/tcg-target.h +++ b/tcg/ia64/tcg-target.h @@ -173,6 +173,7 @@ typedef enum { #define TCG_TARGET_HAS_mulsh_i64 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_deposit_i32_valid(ofs, len) ((len) <=3D 16) #define TCG_TARGET_deposit_i64_valid(ofs, len) ((len) <=3D 16) diff --git a/tcg/mips/tcg-target.h b/tcg/mips/tcg-target.h index f46d64a..e3240cf 100644 --- a/tcg/mips/tcg-target.h +++ b/tcg/mips/tcg-target.h @@ -130,6 +130,7 @@ extern bool use_mips32r2_instructions; #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 #define TCG_TARGET_HAS_bswap32_i32 1 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/ppc/tcg-target.h b/tcg/ppc/tcg-target.h index abd8b3d..a9aa974 100644 --- a/tcg/ppc/tcg-target.h +++ b/tcg/ppc/tcg-target.h @@ -82,6 +82,7 @@ extern bool have_isa_3_00; #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 1 #define TCG_TARGET_HAS_mulsh_i32 1 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_add2_i32 0 diff --git a/tcg/s390/tcg-target.h b/tcg/s390/tcg-target.h index cbdd2a6..6b7bcfb 100644 --- a/tcg/s390/tcg-target.h +++ b/tcg/s390/tcg-target.h @@ -92,6 +92,7 @@ extern uint64_t s390_facilities; #define TCG_TARGET_HAS_mulsh_i32 0 #define TCG_TARGET_HAS_extrl_i64_i32 0 #define TCG_TARGET_HAS_extrh_i64_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_div2_i64 1 #define TCG_TARGET_HAS_rot_i64 1 diff --git a/tcg/sparc/tcg-target.h b/tcg/sparc/tcg-target.h index b8b74f9..9348ddd 100644 --- a/tcg/sparc/tcg-target.h +++ b/tcg/sparc/tcg-target.h @@ -123,6 +123,7 @@ extern bool use_vis3_instructions; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #define TCG_TARGET_HAS_extrl_i64_i32 1 #define TCG_TARGET_HAS_extrh_i64_i32 1 diff --git a/tcg/tcg-op.c b/tcg/tcg-op.c index 95a39b7..e8a140b 100644 --- a/tcg/tcg-op.c +++ b/tcg/tcg-op.c @@ -2587,6 +2587,15 @@ void tcg_gen_goto_tb(unsigned idx) tcg_gen_op1i(INDEX_op_goto_tb, idx); } =20 +void tcg_gen_goto_ptr(TCGv_ptr ptr) +{ + if (TCG_TARGET_HAS_goto_ptr) { + tcg_gen_op1i(INDEX_op_goto_ptr, GET_TCGV_PTR(ptr)); + } else { + tcg_gen_exit_tb(0); + } +} + static inline TCGMemOp tcg_canonicalize_memop(TCGMemOp op, bool is64, bool= st) { /* Trigger the asserts within as early as possible. */ diff --git a/tcg/tcg-op.h b/tcg/tcg-op.h index c68e300..d65727e 100644 --- a/tcg/tcg-op.h +++ b/tcg/tcg-op.h @@ -796,6 +796,15 @@ static inline void tcg_gen_exit_tb(uintptr_t val) */ void tcg_gen_goto_tb(unsigned idx); =20 +/** + * tcg_gen_goto_ptr() - output a jump to a host address + * @ptr: pointer with the target host address + * + * Implementing this operation is optional. If the TCG backend does not su= pport + * it, this call is equivalent to tcg_gen_exit_tb() with 0 as the argument. + */ +void tcg_gen_goto_ptr(TCGv_ptr ptr); + #if TARGET_LONG_BITS =3D=3D 32 #define tcg_temp_new() tcg_temp_new_i32() #define tcg_global_reg_new tcg_global_reg_new_i32 diff --git a/tcg/tcg-opc.h b/tcg/tcg-opc.h index f06f894..c64b994 100644 --- a/tcg/tcg-opc.h +++ b/tcg/tcg-opc.h @@ -193,6 +193,7 @@ DEF(insn_start, 0, 0, TLADDR_ARGS * TARGET_INSN_START_W= ORDS, TCG_OPF_NOT_PRESENT) DEF(exit_tb, 0, 0, 1, TCG_OPF_BB_END) DEF(goto_tb, 0, 0, 1, TCG_OPF_BB_END) +DEF(goto_ptr, 0, 1, 0, TCG_OPF_BB_END) =20 DEF(qemu_ld_i32, 1, TLADDR_ARGS, 1, TCG_OPF_CALL_CLOBBER | TCG_OPF_SIDE_EFFECTS) diff --git a/tcg/tcg.c b/tcg/tcg.c index cb898f1..0ea57c0 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -1138,6 +1138,7 @@ void tcg_dump_ops(TCGContext *s) } switch (c) { case INDEX_op_set_label: + case INDEX_op_goto_tb: case INDEX_op_br: case INDEX_op_brcond_i32: case INDEX_op_brcond_i64: diff --git a/tcg/tci/tcg-target.h b/tcg/tci/tcg-target.h index 838bf3a..0696328 100644 --- a/tcg/tci/tcg-target.h +++ b/tcg/tci/tcg-target.h @@ -85,6 +85,7 @@ #define TCG_TARGET_HAS_muls2_i32 0 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 +#define TCG_TARGET_HAS_goto_ptr 0 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107145683703.7222971981278; Tue, 25 Apr 2017 00:59:05 -0700 (PDT) Received: from localhost ([::1]:47577 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vNI-0003hb-AM for importer@patchew.org; Tue, 25 Apr 2017 03:59:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIg-0008GL-L2 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIf-0000kP-Np for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:18 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59409) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIc-0000fA-Lc; Tue, 25 Apr 2017 03:54:14 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 1575E21F2A; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 88FC57E43A; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=/Ge s7kaRl2H45QkqlVXDFxmcCa9/8GTJAgj2GV6eheU=; b=IOh8Fkc/8WNsTqsWOI/ rrZl7fzwQ4pnYqV8INbQBsln/TqUJgYdAJwIMFC1Q86JzQFefvN7N8fpC47octjA 72VN4mqsq9X/B0vGfcIbV2X80KqZ3Wj451DfysTW2mZOONp12rHsEK+oLeM/RgCs gNRXDYYM/Sv5mOcYAzGfDLgY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=/Ges7kaRl2H45QkqlVXDFxmcCa9/8GTJAgj2GV6eh eU=; b=p0UcyGJK1YIrbFVDU6W0ve+KRlZ0KNhYZkKCh3ycDtF7oYh64fnUEzsws mbCT2U7ZUIapkJUw25LChEqUrLDzbiBpORT95tHBfn452GL+5fbFS00Ky2+pGPjN DNKE+bQ4b0jTC/ug7gaNSCjCMCMaqSeYYxFZFUQGkgGXV+I17YdDEdG8ZEdmiDoZ Cb5L9EVLTLGCYSbYBkTuawha1l3VOsLut12J8XV7LEBg4lt/I2/A8OStmZzLDTNn 9HtunkyfUxk6twXRIm8jGuPXB6IDUcWeIkOta5rIKArPQlVG9ZGRotnwnUMfR+Kv hyr3zzLpUtZojYVC3wsZxqdqpO2Jg== X-ME-Sender: X-Sasl-enc: McDlbYoRN8fnhXF92z9R3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:53 -0400 Message-Id: <1493106839-10438-8-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 07/13] tcg/i386: implement goto_ptr op 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Emilio G. Cota --- tcg/i386/tcg-target.h | 2 +- tcg/i386/tcg-target.inc.c | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/tcg/i386/tcg-target.h b/tcg/i386/tcg-target.h index 59d9835..73a15f7 100644 --- a/tcg/i386/tcg-target.h +++ b/tcg/i386/tcg-target.h @@ -107,7 +107,7 @@ extern bool have_popcnt; #define TCG_TARGET_HAS_muls2_i32 1 #define TCG_TARGET_HAS_muluh_i32 0 #define TCG_TARGET_HAS_mulsh_i32 0 -#define TCG_TARGET_HAS_goto_ptr 0 +#define TCG_TARGET_HAS_goto_ptr 1 =20 #if TCG_TARGET_REG_BITS =3D=3D 64 #define TCG_TARGET_HAS_extrl_i64_i32 0 diff --git a/tcg/i386/tcg-target.inc.c b/tcg/i386/tcg-target.inc.c index 5918008..f6fb03e 100644 --- a/tcg/i386/tcg-target.inc.c +++ b/tcg/i386/tcg-target.inc.c @@ -1906,6 +1906,14 @@ static inline void tcg_out_op(TCGContext *s, TCGOpco= de opc, } s->tb_jmp_reset_offset[a0] =3D tcg_current_code_size(s); break; + case INDEX_op_goto_ptr: + /* save target address into new register */ + tcg_out_mov(s, TCG_TYPE_PTR, TCG_REG_EDX, a0); + /* set return value to 0 */ + tgen_arithr(s, ARITH_XOR, TCG_REG_EAX, TCG_REG_EAX); + /* jmp to the target address (could be epilogue) */ + tcg_out_modrm(s, OPC_GRP5, EXT5_JMPN_Ev, TCG_REG_EDX); + break; case INDEX_op_br: tcg_out_jxx(s, JCC_JMP, arg_label(a0), 0); break; @@ -2277,6 +2285,7 @@ static inline void tcg_out_op(TCGContext *s, TCGOpcod= e opc, =20 static const TCGTargetOpDef *tcg_target_op_def(TCGOpcode op) { + static const TCGTargetOpDef ri =3D { .args_ct_str =3D { "ri" } }; static const TCGTargetOpDef ri_r =3D { .args_ct_str =3D { "ri", "r" } = }; static const TCGTargetOpDef re_r =3D { .args_ct_str =3D { "re", "r" } = }; static const TCGTargetOpDef qi_r =3D { .args_ct_str =3D { "qi", "r" } = }; @@ -2324,6 +2333,9 @@ static const TCGTargetOpDef *tcg_target_op_def(TCGOpc= ode op) case INDEX_op_st_i64: return &re_r; =20 + case INDEX_op_goto_ptr: + return &ri; + case INDEX_op_add_i32: case INDEX_op_add_i64: return &r_r_re; @@ -2569,6 +2581,7 @@ static void tcg_target_qemu_prologue(TCGContext *s) =20 /* TB epilogue */ tb_ret_addr =3D s->code_ptr; + s->code_gen_epilogue =3D s->code_ptr; =20 tcg_out_addi(s, TCG_REG_CALL_STACK, stack_addend); =20 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107345222746.2194362663403; Tue, 25 Apr 2017 01:02:25 -0700 (PDT) Received: from localhost ([::1]:47607 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vQU-0006Z8-V0 for importer@patchew.org; Tue, 25 Apr 2017 04:02:23 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIp-0008Qp-Sm for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pA-JN for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:27 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46153) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hO-IY; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 157AE21F2B; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id B5B45248EE; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=3V6 sdiuHbsI0j+qVeXuAwj3yNFvN/rwxLtZesSYUSu8=; b=ssjnlyDReeV/vWeNTqf XcnZ4KvlK4I77qSzZs658rHveyAoEEF15zxj5bbaPwRPneHB8huLQ5imyxg+hu6y wEWXpstt+RTZV0sL4gJWzjiDxqxqZTReFZOutwwmKrfzrm1rDnsRXUwrqXrgeT0S mVaXky2KkQ+vpQ1mEuCvYo5M= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=3V6sdiuHbsI0j+qVeXuAwj3yNFvN/rwxLtZesSYUS u8=; b=RCFQC3G1O2/EAInrUKzqzHBDZ6UuT0+wr8s6r7pzB5ghnwkAfiQewcmXl Kixr9wga4TagMJz8SyqWh3CRwIRLKU5IluEVwZ3ItQO0XP4PI8HYvQOGLuqxtxm4 HxwcGpQMM78emupy+WqJByA1xB20F5WRAm3JHZf2aaRhdV34vNi1859voRyb1JqV 7f6X2DtckibhnIDbwk+4B8JZIRerhp/a8LsgmZ9cfcs3VAm47ng5n/lJFp5zz8Tj DwdfgcGCAWnDugdWAwFs71X+rfO49EQol9QQAhzwEQC0/kays3TOfgKqp9h+0hCK nglILnUcA8Ocr1NUrHR6/BaHxUSyA== X-ME-Sender: X-Sasl-enc: McD4fIoaKdjzkG9yxiRR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:54 -0400 Message-Id: <1493106839-10438-9-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 08/13] target/arm: optimize cross-page block chaining in softmmu 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of unconditionally exiting to the exec loop, use the lookup_tb_ptr helper to jump to the target if it is valid. As long as the hit rate in tb_jmp_cache remains high, this will improve performance. Perf impact: see the next commit's log. Signed-off-by: Emilio G. Cota --- target/arm/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/arm/translate.c b/target/arm/translate.c index e32e38c..574cf70 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4085,8 +4085,12 @@ static inline void gen_goto_tb(DisasContext *s, int = n, target_ulong dest) gen_set_pc_im(s, dest); tcg_gen_exit_tb((uintptr_t)s->tb + n); } else { + TCGv_ptr ptr =3D tcg_temp_new_ptr(); + gen_set_pc_im(s, dest); - tcg_gen_exit_tb(0); + gen_helper_lookup_tb_ptr(ptr, cpu_env, cpu_R[15]); + tcg_gen_goto_ptr(ptr); + tcg_temp_free_ptr(ptr); } } =20 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107145736580.8052680638551; Tue, 25 Apr 2017 00:59:05 -0700 (PDT) Received: from localhost ([::1]:47578 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vNI-0003hr-DN for importer@patchew.org; Tue, 25 Apr 2017 03:59:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33994) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIq-0008Rc-AV for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pL-Rs for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:59993) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hR-ID; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 4480F21E75; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id E622D7E962; Tue, 25 Apr 2017 03:54:04 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=V/Y rpO6/2k9TxnQVe3ZEh+k90S/i4+cXXfTugLLV4XE=; b=oPJJUYOCN1V5WeuzsDo UZGK0qlutyATOCeYJeDLU7Q5QGuJSLgjwVsHMnwd+gPVjy0reogr/6SjCv/XGexi 1U2OqGAYQKq1NN4/tQ8LMqC1IVRAyPSGmMoyDY4o1G465H3WePGuCorXH7et2ti9 G6YY5EtNb2gPfNNlq+7i+43c= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=V/YrpO6/2k9TxnQVe3ZEh+k90S/i4+cXXfTugLLV4 XE=; b=nbWDKyZ/1aOEAhZZZF/xbxtxoNTbDp1LYkqYhZrJl5Ee+tYCxocVinHfx 3sYAN8Tkq+WtawHaoNIEC1rR1BiFPo4Xdo+YddgVoYHycR6AdkAgT8BnPKY7jNtY QHtDaY0Axsv2XRkcbpwUeLx3tD1IsasM93BMau2qx6fEA4SgwiSxfe2fnovxmeHg lcwQFjpaTSMvwWL/kSbT3Lq8TQXA+2pZrPpzG4/mJVFEL2ntWDgxLihyCuTWYvYw xkJrl1ckABUJaVRRPrXL7aU3q75Q3JDd8SrfpZRc1NC01RPymvi2Kj8pmLO+FC6x 532wDQkLOxRw+Utov1E8/xxQzgJUg== X-ME-Sender: X-Sasl-enc: McDudosGJtTogGV9zCdR3HgI4wlwRuVbhondrqX23xnS 1493106844 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:55 -0400 Message-Id: <1493106839-10438-10-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 09/13] target/arm: optimize indirect branches with TCG's goto_ptr 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Speed up indirect branches by directly jumping to the target if it is valid, i.e. if it is found in tb_jmp_cache. Softmmu measurements: (see later commit for user-mode results) Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - Impact on Boot time | setup | ARM debian boot+shutdown time | stddev | |---------------+-------------------------------+--------| | v2.9.0 | 10.35 | 0.07 | | +cross+inline | 10.32 | 0.03 | | +jr+inline | 10.59 | 0.20 | - NBench, arm-softmmu (debian jessie guest). Hos= t: Intel i7-4790K @ 4.00GHz 1.25x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | +++ = | | | cross+inline #### = | | 1.2x +cross+jr+inline.........................................#++#......#= ###.........................................+-+ | +++# # #= | # | | +++ +++ **** # #= | # +++ | | | #### * * # #= ++# | | 1.15x +-+................................****++#............*..*..#......#= ..#.....####................................+-+ | *++* # * * # #= # # |# | | * * # +++ * * # #= # #++# | 1.1x +-+................................*..*..#.......|....*..*..#......#= ..#.....#..#................................+-+ | * * # #### * * # #= # # # #### | | +++ * * # #++# * * # #= # # # # # | | #### * * # # # * * # #= # # # # # | 1.05x +-+..........................#++#..*..*..#......#..#..*..*..#...+++#= ..#.....#..#................+++......#..#...+-+ | # # * * # # # * * # *****= # # # +++#### ***** # | | ++++++ +++ +++ # # * * # +++# # * * # * | *= # # # **** # *+++* # | 1x +-++-+++++####++****###++++-+#++#+-*++*++#-+++++#-+#++*++*++#++*+-+*= ++#+-+++#++#-+*****###++*++*++#++*+-+*++#+-++-+ | *****++# *++*++# | # # * * # | # # * * # * *= # **** # *+++*++# * * # * * # | | *+++* # * * # ***** # * * # ***** # * * # * *= # *++* # * * # * * # * * # | | * * # * * # *+++* # * * # * | * # * * # * *= # * * # * * # * * # * * # | 0.95x +-+...*...*..#..*..*..#..*...*..#..*..*..#..*+++*..#..*..*..#..*...*= ..#..*..*..#..*...*..#..*..*..#..*...*..#...+-+ | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.9x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/528aS76 NB. 'cross' represents the previous commit. Signed-off-by: Emilio G. Cota --- target/arm/translate.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/target/arm/translate.c b/target/arm/translate.c index 574cf70..d5296b1 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -65,6 +65,7 @@ static TCGv_i32 cpu_R[16]; TCGv_i32 cpu_CF, cpu_NF, cpu_VF, cpu_ZF; TCGv_i64 cpu_exclusive_addr; TCGv_i64 cpu_exclusive_val; +static bool gen_jr; =20 /* FIXME: These should be removed. */ static TCGv_i32 cpu_F0s, cpu_F1s; @@ -221,6 +222,7 @@ static void store_reg(DisasContext *s, int reg, TCGv_i3= 2 var) */ tcg_gen_andi_i32(var, var, s->thumb ? ~1 : ~3); s->is_jmp =3D DISAS_JUMP; + gen_jr =3D true; } tcg_gen_mov_i32(cpu_R[reg], var); tcg_temp_free_i32(var); @@ -893,6 +895,7 @@ static inline void gen_bx_im(DisasContext *s, uint32_t = addr) tcg_temp_free_i32(tmp); } tcg_gen_movi_i32(cpu_R[15], addr & ~1); + gen_jr =3D true; } =20 /* Set PC and Thumb state from var. var is marked as dead. */ @@ -902,6 +905,7 @@ static inline void gen_bx(DisasContext *s, TCGv_i32 var) tcg_gen_andi_i32(cpu_R[15], var, ~1); tcg_gen_andi_i32(var, var, 1); store_cpu_field(var, thumb); + gen_jr =3D true; } =20 /* Variant of store_reg which uses branch&exchange logic when storing @@ -12034,6 +12038,16 @@ void gen_intermediate_code(CPUARMState *env, Trans= lationBlock *tb) gen_set_pc_im(dc, dc->pc); /* fall through */ case DISAS_JUMP: + if (gen_jr) { + TCGv_ptr ptr =3D tcg_temp_new_ptr(); + + gen_jr =3D false; + gen_helper_lookup_tb_ptr(ptr, cpu_env, cpu_R[15]); + tcg_gen_goto_ptr(ptr); + tcg_temp_free_ptr(ptr); + break; + } + /* fall through */ default: /* indicate that the hash table must be used to find the next = TB */ tcg_gen_exit_tb(0); --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493106994107568.6150799851289; Tue, 25 Apr 2017 00:56:34 -0700 (PDT) Received: from localhost ([::1]:47567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vKr-0001V0-1P for importer@patchew.org; Tue, 25 Apr 2017 03:56:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33993) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIq-0008Ra-9r for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000pG-SB for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:51193) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hY-Ic; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 8749921F3A; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 23C4024774; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=vCS VxhpgXscLs0zC043DB4MTBaK2RULIqjmCh6CYfAw=; b=jB8HlCw0p+Kqen/8QXR k0/cLyOCEx2oyjI085s5GOupwEGBNh0Hvgdyzraa9iQDyAzDOazsGbj1in1dxuix Y3FErvkR2D038+i+Ar3D3aZYmWN4NiXg6jRq0GRdBDhUrYeVQAvtl3fNJCG2xUFE I0439713K1dVVfKD4U75GFS4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=vCSVxhpgXscLs0zC043DB4MTBaK2RULIqjmCh6CYf Aw=; b=N4gBKmiWA/2oJhT9nYLYaWDHFNnH7UPVBf4aaJtawoagAj2ImaJ7AoRyQ 4NV2Q1KxzsrA2hLulpxEm7p6xfmwKGI9l6WoNZ1D2U+QsLT+QeFeb1joz39Q2+FM uxTLXFhrGz/12f62mu0I2/BUeWjxXt/V0FufycmPjPT4rKZA/zdq7uhcCzoqSDhD +ljuGdwR5jKj39dxO07mRK72ta8leysC7L9KW1Nk44FM8ShqTIWzciyJvWbpVByN v5nlRrqSDtj9oGK0RGR8vmltORQa0nMUhUE0C6maXoICtOcl/Q1KhBdsDPDXvcBN 5MeaEYKdRyKYYtTkxvV9Mql1XWyeQ== X-ME-Sender: X-Sasl-enc: AXHflI/728IFJACD3t5rtHWprVzUq/D0sPaU5F1VjIJR 1493106845 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:56 -0400 Message-Id: <1493106839-10438-11-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 10/13] target/i386: introduce gen_jr() helper to jump to register 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This helper will be used by subsequent commits. Signed-off-by: Emilio G. Cota --- target/i386/translate.c | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 1d1372f..445082b 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -141,6 +141,7 @@ typedef struct DisasContext { } DisasContext; =20 static void gen_eob(DisasContext *s); +static void gen_jr(DisasContext *s, TCGv dest); static void gen_jmp(DisasContext *s, target_ulong eip); static void gen_jmp_tb(DisasContext *s, target_ulong eip, int tb_num); static void gen_op(DisasContext *s1, int op, TCGMemOp ot, int d); @@ -2509,7 +2510,8 @@ static void gen_bnd_jmp(DisasContext *s) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. If RECHECK_TF, emit a rechecking helper for #DB, ignoring the state of S->TF. This is used by the syscall/sysret insns. */ -static void gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf) +static void +gen_eob_worker(DisasContext *s, bool inhibit, bool recheck_tf, TCGv jr) { gen_update_cc_op(s); =20 @@ -2530,6 +2532,16 @@ static void gen_eob_worker(DisasContext *s, bool inh= ibit, bool recheck_tf) tcg_gen_exit_tb(0); } else if (s->tf) { gen_helper_single_step(cpu_env); + } else if (jr) { + TCGv vaddr =3D tcg_temp_new(); + TCGv_ptr ptr =3D tcg_temp_new_ptr(); + + tcg_gen_ld_tl(vaddr, cpu_env, offsetof(CPUX86State, segs[R_CS].bas= e)); + tcg_gen_add_tl(vaddr, vaddr, jr); + gen_helper_lookup_tb_ptr(ptr, cpu_env, vaddr); + tcg_temp_free(vaddr); + tcg_gen_goto_ptr(ptr); + tcg_temp_free_ptr(ptr); } else { tcg_gen_exit_tb(0); } @@ -2540,13 +2552,19 @@ static void gen_eob_worker(DisasContext *s, bool in= hibit, bool recheck_tf) If INHIBIT, set HF_INHIBIT_IRQ_MASK if it isn't already set. */ static void gen_eob_inhibit_irq(DisasContext *s, bool inhibit) { - gen_eob_worker(s, inhibit, false); + gen_eob_worker(s, inhibit, false, NULL); } =20 /* End of block, resetting the inhibit irq flag. */ static void gen_eob(DisasContext *s) { - gen_eob_worker(s, false, false); + gen_eob_worker(s, false, false, NULL); +} + +/* Jump to register */ +static void gen_jr(DisasContext *s, TCGv dest) +{ + gen_eob_worker(s, false, false, dest); } =20 /* generate a jump to eip. No segment change must happen before as a @@ -7131,7 +7149,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* TF handling for the syscall insn is different. The TF bit is c= hecked after the syscall insn completes. This allows #DB to not be generated after one has entered CPL0 if TF is set in FMASK. */ - gen_eob_worker(s, false, true); + gen_eob_worker(s, false, true, NULL); break; case 0x107: /* sysret */ if (!s->pe) { @@ -7146,7 +7164,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, checked after the sysret insn completes. This allows #DB to= be generated "as if" the syscall insn in userspace has just completed. */ - gen_eob_worker(s, false, true); + gen_eob_worker(s, false, true, NULL); } break; #endif --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107159456575.0631487013223; Tue, 25 Apr 2017 00:59:19 -0700 (PDT) Received: from localhost ([::1]:47579 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vNW-0003tQ-BP for importer@patchew.org; Tue, 25 Apr 2017 03:59:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33955) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIp-0008QW-IN for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIo-0000ox-F2 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:27 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:42893) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hb-IT; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9F3CD21F3C; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 568117E96F; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=y0C jSxjfTR2FVTA8ONLuT936VOXcL5FIJexxz7x9tkc=; b=0Aw6JEHxxob1zmpwGoJ uqg5liHqb6SYhVtcxD8NFSukfeWwNIILcG5U9yNCvqwGGPJc3iAwIs7A8vzSjGYh QoIcyTvKrBtm236Sfm9NPQMCO6zJEFoIjKvsNPTXOYPiKFsL8NWsgXRfC3G3yEeT p+oR5+lzawmdhGlam5MzbWDg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=y0CjSxjfTR2FVTA8ONLuT936VOXcL5FIJexxz7x9t kc=; b=K29daeJRLG4km+Z2RkBV12voEDDeRxQObNHjs3jp85+f0eD0vZFF5A8JN URdJQcPnkwqZrRwJ+n3dSHrvCX3UtRdnxqOMNCf624KHCTyMXs/W2WW3V1XUTWW+ 6p0/Kkve6r0Z3ppJTSsfR1FGr36CAzzi3riEpAnjraFOf0v4luGX/QaXcKYJwnhM 3giMIAo4tL5pYPnQGdiydDlP5scXbBGjBOCSSIya6PXq/WPP7DngxPoXe4MZwfa5 t4Ly27Bx6GqD+9RV7Mvrj70icRBwsT07BofL0tyP1NKeHAms6NjFHVowZlNp9gwJ X/OaSN5lPLy9YQW4dlcohqT19p5lg== X-ME-Sender: X-Sasl-enc: AXHZl4PkwMIBPRqR3tNrtHWprVzUq/D0sPaU5F1VjIJR 1493106845 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:57 -0400 Message-Id: <1493106839-10438-12-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 11/13] target/i386: optimize cross-page direct jumps in softmmu 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Instead of unconditionally exiting to the exec loop, use the gen_jr helper to jump to the target if it is valid. As long as the hit rate in tb_jmp_cache remains high, this change improves performance. Perf impact: see the next commit's log. Signed-off-by: Emilio G. Cota --- target/i386/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 445082b..9982a2d 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -2154,9 +2154,9 @@ static inline void gen_goto_tb(DisasContext *s, int t= b_num, target_ulong eip) gen_jmp_im(eip); tcg_gen_exit_tb((uintptr_t)s->tb + tb_num); } else { - /* jump to another page: currently not optimized */ + /* jump to another page */ gen_jmp_im(eip); - gen_eob(s); + gen_jr(s, cpu_tmp0); } } =20 --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 14931075929911023.376070830104; Tue, 25 Apr 2017 01:06:32 -0700 (PDT) Received: from localhost ([::1]:47631 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vUV-0001Nv-Lq for importer@patchew.org; Tue, 25 Apr 2017 04:06:31 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34004) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIq-0008Sb-O1 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIp-0000pb-1b for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:28 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:55119) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hj-Hq; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id EC61821F3E; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:05 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id 88D5C24811; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=5k8 sxL+PF1uqkDCQo/1S5UFdjziH/x6eLKOacuSVhsM=; b=nCl2omGW/z+RBUJOVwB 1rsGcfMvPjS2k/Ng+x1/E/io+X930n2GshxMLtRvbxUqGfxm6BPu+xetggEUSaqM M+663BWK1qW2gwNtcOCoDsP7hm9pOnVcxpdjvEM2I5q9rgcny6tDYUiri3reqds9 UE9mydsQCQCEkGCirotqvWrQ= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=5k8sxL+PF1uqkDCQo/1S5UFdjziH/x6eLKOacuSVh sM=; b=TQmLNTDFUsTEG9Cf1nSlTIWtV7yNNhL0ciLFSwm/StvuiOUy1Q4Oh0c3q fD9oMsBcbAs+LbXnvOQqj5nP6trJwQSGufbLQRPjoaCJj+Fn9/Br1EMFiows5FdO 7BGA9FcPxwsu3lZ+PB8blIDv2FG8BarpmW/sBp9X/vE8+vHYzN0mKPJHQA5tiE3v GMvJXG3Koucn4rW24bSVSTsiMEvU8AYla36w9kVAXTyFG8pIHcUeecck6QObWTN1 i/Uus3Wo3sXT4Qi+mbrOv+lNLd5osGIkefxkkz/J9IeGZxwqulGmTfwHuTubiStu RsNiwbGop12y8NgGunyxBzMAOE8uQ== X-ME-Sender: X-Sasl-enc: AXHGlp/5xcsEMQGVydNrtHWprVzUq/D0sPaU5F1VjIJR 1493106845 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:58 -0400 Message-Id: <1493106839-10438-13-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 12/13] target/i386: optimize indirect branches 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The appended minimizes exits to the exec loop for indirect branches. By using the gen_jr helper, we can remain in TCG mode as long as the indirect branch target is found in tb_jmp_cache. This should improve performance for workloads that have a high hit rate in tb_jmp_cache. Softmmu Measurements: (see user-mode measurements in later commit) Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - SPECint06 (test set), x86_64-softmmu (Ubuntu 16.04 gues= t). Host: Intel i7-4790K @ 4.00GHz 2.2x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = +++ | | cross+inline = | | 2x +cross+jr+inline.....................................................= ...........+++.|............................+-+ | = | | | | = | | | | = | | | 1.8x +-+..................................................................= ............|..|............................+-+ | = |#### | | = |# |# | 1.6x +-+..................................................................= ..........****.|#...........................+-+ | = * |* |# | | = * |* |# | | = * |* |# | 1.4x +-+..................................................................= .....+++..*.|*.|#...........................+-+ | +++ = | * |*++# +++ | | +++ | = #### * |* # +++ | | 1.2x +-+......................###.............+++............|.+++........= .....#++#.*++*..#...........|..|............+-+ | +++# # +++ | | | = ++# # * * # +++ ****## #### | | ++#### **** # +++#### #### *** | = **** # * * # ++#### *| *|# ****++# | | ****++# ++#### * * # **** # ++#| # ++#### *|*### ****##= * * # * * # *** |# *++*+# *++* # | 1x +-++-*++*++#++***+-#++*++*+#++*+-*++#+****++#++***++#+-*+*++#-+*++*+#= ++*++*-+#+*++*-+#++*+*++#++*-+*+#++*++*++#-++-+ | * * # * * # * * # * * # *++* # * * # *+* |# * * #= * * # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *++# * * #= * * # * * # * * # * * # * * # | 0.8x +-+--****###--***###--****##--****###-****###--***###--***###--****##= --****###-****###--***###--****##--****###--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/aSXm0qh NB. 'cross' represents the previous commit. Signed-off-by: Emilio G. Cota --- target/i386/translate.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/target/i386/translate.c b/target/i386/translate.c index 9982a2d..0b4e1e1 100644 --- a/target/i386/translate.c +++ b/target/i386/translate.c @@ -4991,7 +4991,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_push_v(s, cpu_T1); gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 3: /* lcall Ev */ gen_op_ld_v(s, ot, cpu_T1, cpu_A0); @@ -5009,7 +5009,8 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, tcg_const_i32(dflag - 1), tcg_const_i32(s->pc - s->cs_base)); } - gen_eob(s); + tcg_gen_ld_tl(cpu_tmp4, cpu_env, offsetof(CPUX86State, eip)); + gen_jr(s, cpu_tmp4); break; case 4: /* jmp Ev */ if (dflag =3D=3D MO_16) { @@ -5017,7 +5018,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, } gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 5: /* ljmp Ev */ gen_op_ld_v(s, ot, cpu_T1, cpu_A0); @@ -5032,7 +5033,8 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, gen_op_movl_seg_T0_vm(R_CS); gen_op_jmp_v(cpu_T1); } - gen_eob(s); + tcg_gen_ld_tl(cpu_tmp4, cpu_env, offsetof(CPUX86State, eip)); + gen_jr(s, cpu_tmp4); break; case 6: /* push Ev */ gen_push_v(s, cpu_T0); @@ -6412,7 +6414,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* Note that gen_pop_T0 uses a zero-extending load. */ gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 0xc3: /* ret */ ot =3D gen_pop_T0(s); @@ -6420,7 +6422,7 @@ static target_ulong disas_insn(CPUX86State *env, Disa= sContext *s, /* Note that gen_pop_T0 uses a zero-extending load. */ gen_op_jmp_v(cpu_T0); gen_bnd_jmp(s); - gen_eob(s); + gen_jr(s, cpu_T0); break; case 0xca: /* lret im */ val =3D cpu_ldsw_code(env, s->pc); --=20 2.7.4 From nobody Fri May 3 22:11:20 2024 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.zoho.com; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1493107298022474.6415993769873; Tue, 25 Apr 2017 01:01:38 -0700 (PDT) Received: from localhost ([::1]:47605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vPk-0005vd-2e for importer@patchew.org; Tue, 25 Apr 2017 04:01:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34069) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d2vIv-00007L-Ru for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d2vIs-0000rF-K8 for qemu-devel@nongnu.org; Tue, 25 Apr 2017 03:54:33 -0400 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:58905) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1d2vIj-0000hw-IG; Tue, 25 Apr 2017 03:54:21 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 162EC21F23; Tue, 25 Apr 2017 03:54:06 -0400 (EDT) Received: from frontend1 ([10.202.2.160]) by compute4.internal (MEProxy); Tue, 25 Apr 2017 03:54:06 -0400 Received: from localhost (flamenco.cs.columbia.edu [128.59.20.216]) by mail.messagingengine.com (Postfix) with ESMTPA id BC4BD7E0EE; Tue, 25 Apr 2017 03:54:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=braap.org; h=cc :date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc:x-sasl-enc; s=mesmtp; bh=s+8 HEVymHu6nfiCAkM0PAl2FnRIyZUoKX9jfN3mgt+Q=; b=zS1LDyX8toH3qVlHjmR IHnfYRAhb2t52Rwb2p2owrXPSCBlEEg4jvWlz0kVr/uH7pb109P6vRhyshJuL8iO NWJXssimwcxkIMJ0mjKFxtHw8VWuQW78gp895bUVMuXPW5xPFw7i86GWFWXBjFGC U1OHWqiRZWQq23mLmWmOJUhw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc :x-sasl-enc; s=fm1; bh=s+8HEVymHu6nfiCAkM0PAl2FnRIyZUoKX9jfN3mgt +Q=; b=X3bjEFQggqU/IuXquvm6KdZ7RF7IqYhY4sIhe5GinZ4sbi9EnDFYrMn64 P/gDXZjYEYrXz5pRHGBse6umyRUPc8S4c39sbLYsoyJseDW5SQxK53pFJDn1of4U oEgfKlvP4QomRlnchqEfFIA0m4F8js5YLRC0N/e1lWGOzxdBfPg57BZCZS1jZ1KT mYKB8JG+LA/A1OXxHykltEcjpRbAhH7m/sQKQN3+NtiXbfUp7xLQOmROIHX5w6m1 eUGiz0dvELvGwwLoq2vW9wGN3o42pDS411I8iIfbL72247uNvvLOkaCcA9396xxb 4HZaoGSaMpuHfcdcsjS/dZvPH0FEA== X-ME-Sender: X-Sasl-enc: AXHJjJjw3ssMIwSD2NFrtHWprVzUq/D0sPaU5F1VjIJR 1493106845 From: "Emilio G. Cota" To: qemu-devel@nongnu.org Date: Tue, 25 Apr 2017 03:53:59 -0400 Message-Id: <1493106839-10438-14-git-send-email-cota@braap.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1493106839-10438-1-git-send-email-cota@braap.org> References: <1493106839-10438-1-git-send-email-cota@braap.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.111.4.28 Subject: [Qemu-devel] [PATCH v2 13/13] tb-hash: improve tb_jmp_cache hash function in user mode 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 , Eduardo Habkost , Peter Crosthwaite , Stefan Weil , Alexander Graf , alex.bennee@linaro.org, qemu-arm@nongnu.org, Pranith Kumar , Paolo Bonzini , Aurelien Jarno , Richard Henderson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Optimizations to cross-page chaining and indirect branches make performance more sensitive to the hit rate of tb_jmp_cache. The constraint of reserving some bits for the page number lowers the achievable quality of the hashing function. However, user-mode does not have this requirement. Thus, with this change we use for user-mode a hashing function that is both faster and of better quality than the previous one. Measurements: Note: baseline (i.e. speedup =3D=3D 1x) is QEMU v2.9.0. - SPECint06 (test set), x86_64-linux-user. Host:= Intel i7-6700K @ 4.00GHz 2x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = +++++ | | jr+noinline = | | | | jr+inline = ++%%@ | 1.8x +-+jr+hash+noinline +.........................................= .....|%%@...................................+-+ |jr+multhash+inline = |%%@+ | | jr+hash+inline = +$$$%@ | | = ++##|$%@ +++ | 1.6x +-+..................................................................= ..|##|$%@....................+%%%...........+-+ | @@+ = **#+$%@ $$+% | | $$$%@+ = +**#+$%@ ++++ ++$$+%@ | | ++++ $ $%@ = **# $%@ +$$%@@+++$$ %@ | 1.4x +-+.....................+%%%@..........##+$%@........................= ..**#.$%@...........+$$%.@***$$.%@..........+-+ | ++$$+%@ ##+$%@ = **# $%@ $$% @* *#$+%@ | | ***#$ %@ +**# $%@ = **# $%@ +###$% @* *#$ %@ | | *+*#$ %@ +%%@+**# $%@ = **# $%@ **+#$% @*+*#$ %@ +%%%@+ | 1.2x +-+..................*.*#$.%@***#$$%@+**#.$%@........................= ..**#.$%@.........**.#$%.@*.*#$.%@***#$+%@+.+-+ | +++ * *#$ %@* *# $%@ **# $%@ +++++++ = **# $%@ +++%%@@** #$% @* *#$ %@*+*#$ %@ | | ++###$%+ * *#$ %@* *# $%@ **# $%@ **##$%@@ = **# $%@+**#$$%+@** #$% @* *#$ %@* *#$ %@ | | +**+#$%@@ ++$$@@@* *#$ %@* *# $%@ **# $%@ ** #$% @+###++@@++++%%%= + **# $%@ **# $% @** #$% @* *#$ %@* *#$ %@ | 1x +-++-**+#$%-@**##$%+@*+*#$+%@*+*#+$%@+**#+$%@+**+#$%+@**+#$+@@***#$+%= @+**#+$%@+**#+$%+@**+#$%+@*+*#$+%@*-*#$+%@-++-+ | ** #$% @** #$% @* *#$ %@* *# $%@ **# $%@ ** #$% @** #$%%@* *#$ %= @ **# $%@ **# $% @** #$% @* *#$ %@* *#$ %@ | | ** #$% @** #$% @* *#$ %@* *# $%@ **# $%@ ** #$% @** #$+%@* *#$ %= @ **# $%@ **# $% @** #$% @* *#$ %@* *#$ %@ | | ** #$% @** #$% @* *#$ %@* *# $%@ **# $%@ ** #$% @** #$ %@* *#$ %= @ **# $%@ **# $% @** #$% @* *#$ %@* *#$ %@ | 0.8x +-+--**##$%@@**##$%@@***#$%%@***#$$%@-**#$$%@-**##$%@@**##$%%@***#$%%= @-**#$$%@-**#$$%@@**##$%@@***#$%%@***#$%%@--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/1ZJGjzV Here I also tried the hash function suggested by Paolo ("multhash"): return ((uint64_t) (pc * 2654435761) >> 32) & (); As you can see it is just as good as the other new function ("hash"), but I kept "hash" because with it all benchmarks have speedup > 1. - SPECint06 (train set), x86_64-linux-user. Host: = Intel i7-6700K @ 4.00GHz 2.6x +-+------------------------------------------------------------------= --------------------------------------------+-+ | = | | jr+inline = | 2.4x +jr+inline+hash......................................................= ..............................###...........+-+ | = # # | | = # # | 2.2x +-+..................................................................= ..............................#.#...........+-+ | = # # | | = # # | 2x +-+..................................................................= ..............................#.#...........+-+ | = # # | | = **** # | 1.8x +-+..................................................................= ...........................*..*.#...........+-+ | = +++ #### * * # | | = #### ****++# * * # | 1.6x +-+......................................+++.........................= ..****..#.*++*..#..........*..*.#...........+-+ | #### = *++* # * * # +++ * * # | | +++ ++#++# = * * # * * # #### * * # | 1.4x +-+...................+++###..........****..#........................= ..*..*..#.*..*..#....#..#..*..*.#...........+-+ | ****+# * * # = * * # * * # *** # * * # #### | | *++* # +++ * * # = * * # * * # *+* # * * # ****++# | 1.2x +-+...................*..*.#..****###.*..*..#........................= ..*..*..#.*..*..#..*.*..#..*..*.#..*..*..#..+-+ | ****### +++ * * # * * # * * # = * * # * * # * * # * * # * * # | | * *++# ***### * * # * * # * * # = * * # * * # * * # * * # * * # | 1x +-+--****###--***###--****##--****###-****###--***###--***###--****##= --****###-****###--***###--****##--****###--+-+ astar bzip2 gcc gobmk h264ref hmmlibquantum mcf om= netpperlbench sjengxalancbmk hmean png: http://imgur.com/1D2VFze - NBench, x86_64-linux-user. Host: Intel = i7-6700K @ 4.00GHz 1.1x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | = | | jr+inline = | 1.08x +jr+hash+noinline +..............................+++.........= ............................................+-+ | jr+hash+inline | = | | +++| = | | | |+++ = | 1.06x +-+....................................................|.|.|........= ............................................+-+ | |###| = +++++ | | |#|#| = ###$$$ | 1.04x +-+.........................+++....+++.+++.............|#|#$$$......= ........................++#|#++$............+-+ | |+++ |+++| ****|#| $ = +++ |#+# $ | | | | | | | * |*+#| $ = |+++ **** # $ | | +++ +++ | | ****| | * |* #++$ = | |+++ * |* # $ | 1.02x +-+....|..................|####$$.*.|*|$$$$.++++++++.*.|*.#..$......= ....****|.|............*++*.#..$.++++++++...+-+ | ***+++ |# |#|$ * |*##| $ | | | * |* # $ = * |*| | +++ * * # $ ***###$$ | | *|* |+++ +++ +++ *** |#|$ * |*|#| $ ***###$$ *++* # $ = +++ * |*##$$$ ####++ * * # $ *+*++# $ | 1x +-++-+*+*###+++****-$$$$+*+*++#+$+*++*+#++$+*+*++#+$+*++*-#++$+++-++= $$$+*++*+#++$+***++#$$+*++*-#++$+*+*++#+$+-++-+ | * *++#$$ *++*|$++$ *|*++# $ * *+#++$ *+*++#|$ * * # $ *** |= $+$ * *|#| $ *+* #+$ * * # $ * * # $ | | * * #+$ * *## $ *+* # $ * * # $ * * #+$ * * # $ *+*##= # $ * *|#++$ * * # $ * * # $ * * # $ | | * * # $ * *|# $ * * # $ * * # $ * * # $ * * # $ * *++= # $ * *+# $ * * # $ * * # $ * * # $ | 0.98x +-+...*.*..#.$.*..*+#..$.*.*..#.$.*..*.#..$.*.*..#.$.*..*.#..$.*.*..= #.$.*..*.#..$.*.*..#.$.*..*.#..$.*.*..#.$...+-+ | * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * = # $ * * # $ * * # $ * * # $ * * # $ | | * * # $ * * # $ * * # $ * * # $ * * # $ * * # $ * * = # $ * * # $ * * # $ * * # $ * * # $ | 0.96x +-+---***###$$-****##$$$-***###$$-****##$$$-***###$$-****##$$$-***##= #$$-****##$$$-***###$$-****##$$$-***###$$---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/xK9YfOB - NBench, arm-linux-user. Host: Intel i7= -4790K @ 4.00GHz 1.3x +-+-----------------------------------------------------------------= --------------------------------------------+-+ | #### = +++ | | jr+inline #++# = #### | 1.25x +jr+hash+inline..............#..#...................................= ........#++#................................+-+ | # # = # # | | # # = # # | | # # = # # | 1.2x +-+..........................#..#..................................#= ###.....#..#................................+-+ | # # +++#= ++# # # | | # # *****= # # # | 1.15x +-+..........................#..#..............................*+++*= ..#.....#..#................................+-+ | # # * *= # **** # | | # # * *= # *++* # | | # # * *= # * * # | 1.1x +-+..........................#..#...............+++............*...*= ..#..*..*..#................................+-+ | # # +++#### * *= # * * # #### | | # # ***** # * *= # * * # # # | 1.05x +-+..........................#..#...........*...*..#...........*...*= ..#..*..*..#...............####......#..#...+-+ | # # +++ * * # * *= # * * # #++# ***** # | | +++# # ****### * * # ****### * *= # * * # +++# # * * # | | ++++++ ****### ***** # *++*++# * * # *++*++# * *= # * * # ++++++ **** # * * # | 1x +-++-+*****###++*++*++#++*+-+*++#+-*++*++#-+*+++*-+#++*++*++#++*+-+*= ++#+-*++*++#-+*****###++*++*++#++*+-+*++#+-++-+ | *+++*++# * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | | * * # * * # * * # * * # * * # * * # * *= # * * # * * # * * # * * # | 0.95x +-+---*****###--****###--*****###--****###--*****###--****###--*****= ###--****###--*****###--****###--*****###---+-+ ASSIGNMENT BITFIELD FOURFP EMULATION HUFFMAN LU DECOMPOSITIONE= URAL NNUMERIC SOSTRING SORT hmean png: http://imgur.com/uhIEOA1 Signed-off-by: Emilio G. Cota Reviewed-by: Richard Henderson --- include/exec/tb-hash.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h index 2c27490..b1fe2d0 100644 --- a/include/exec/tb-hash.h +++ b/include/exec/tb-hash.h @@ -22,6 +22,8 @@ =20 #include "exec/tb-hash-xx.h" =20 +#ifdef CONFIG_SOFTMMU + /* Only the bottom TB_JMP_PAGE_BITS of the jump cache hash bits vary for addresses on the same page. The top bits are the same. This allows TLB invalidation to quickly clear a subset of the hash table. */ @@ -45,6 +47,16 @@ static inline unsigned int tb_jmp_cache_hash_func(target= _ulong pc) | (tmp & TB_JMP_ADDR_MASK)); } =20 +#else + +/* In user-mode we can get better hashing because we do not have a TLB */ +static inline unsigned int tb_jmp_cache_hash_func(target_ulong pc) +{ + return (pc ^ (pc >> TB_JMP_CACHE_BITS)) & (TB_JMP_CACHE_SIZE - 1); +} + +#endif /* CONFIG_SOFTMMU */ + static inline uint32_t tb_hash_func(tb_page_addr_t phys_pc, target_ulong pc, uint32_t fl= ags) { --=20 2.7.4