From patchwork Thu Feb 14 04:06:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 158313 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp881259jaa; Wed, 13 Feb 2019 20:09:42 -0800 (PST) X-Google-Smtp-Source: AHgI3IZIa4m/eVrPEVE0GHUPNzmVvgP8apcR3p+UHkijyKGmzFuPIBpa9FYWKcqNOx3KJZula2eO X-Received: by 2002:a81:7084:: with SMTP id l126mr1235753ywc.203.1550117382672; Wed, 13 Feb 2019 20:09:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550117382; cv=none; d=google.com; s=arc-20160816; b=nuZjz8CwW2tzUhm11t5zNQogACbb/m0pTPOnaZ8Ub+6JbWBs9a2lDtc1TbmgIzL+GY EUY+PbK4uSqrjXkqQRMWEhksiqQWLKFocQJwXkos522E1BSvEEznskpiop5dNaFFdq42 HVjmmSA2vLmUBeOf/X1ZggbMalAcMrvbp79E2MuCML+asxyQqqFzjvWjbGIQ/b+2iTPL je0LjEwjbaFVJgB6LoMJdgcKPTj1n4faJbRrUUgnfkBlzOQPjg/+BW/U51kON95FzclE kicIIKz6zzdUacMEUV/TJErWDFifdWAXgtQScO2GotdgvNQVFQI4CAUOksrsGv/JcJST yKCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=qiwGK9NKR9zng2waAo5zTZuYYKgXgK/hMyrBttacMdQ=; b=S44qvsl/Y2t4fNA1p6MhF2yHZ1Yh0PK9WCQB88+xSxVboLHHNa3f22SoRLYSE8lyK5 h7/Uwf+aTDDBxWKEED6NibHogISr77M+94gosm1i7urh8UT9BU9uOGWMU8+hd2kQ68RZ 3eW9oxgth5cO+LeZkLJ4JGMWIGlxzUbvhvRg5Gwz1smOeUMyFutSGZjN5LMqEhDvsb0w 8o0DdWx1EUYO4Cx9ppGW+ndU3hV9YwKiUQ9pKDPzlxBEedpiy3NqflN1Jc1I3n+zA8of rEoXVPGTOuxjhtAGjS9UL8bTWVlq2BkULJN2MODovzcPymi71A7Q/n7jUp5JXm2j5r9F TB/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fkopXoAT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id z126si706948yba.57.2019.02.13.20.09.42 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 13 Feb 2019 20:09:42 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=fkopXoAT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1]:39558 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gu8LG-0004wa-6s for patch@linaro.org; Wed, 13 Feb 2019 23:09:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:35065) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gu8Im-0003Ij-3I for qemu-devel@nongnu.org; Wed, 13 Feb 2019 23:07:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gu8If-0005gp-Ai for qemu-devel@nongnu.org; Wed, 13 Feb 2019 23:07:05 -0500 Received: from mail-pl1-x641.google.com ([2607:f8b0:4864:20::641]:39423) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gu8Ie-0005eq-Uk for qemu-devel@nongnu.org; Wed, 13 Feb 2019 23:07:01 -0500 Received: by mail-pl1-x641.google.com with SMTP id 101so2402079pld.6 for ; Wed, 13 Feb 2019 20:07:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=qiwGK9NKR9zng2waAo5zTZuYYKgXgK/hMyrBttacMdQ=; b=fkopXoATYL9Lcn/VRDRcQBVnwQtktuMOdG3RV9q1Rn4OSN4wN1WSO95HfrWkzlbsvJ EdN/mQ0J3y5p2cigW1g40BQpl4yw9pMs4RbKUc8Dc9V6f0o9S+K+hPFlSlYARX2mbOiD IHxV6QRX/6cVqE+8KpkK41lDhlbeyy+nFBdPt3cLzl6I0kzREeq7hJ1czOGAB/yv2cJH MFjQFypjb+ztoKlaFW6T21YuXRl5wsxruckMexUv5xrd37XgGkb+t/bWR5T64jeBgSZS eTnzhGvJndP2CkRtCV45cZOXtQKSQWE7Di3bc2IHn3OkjNab2obA/EH/Mk/Z3wCD/Ars vuYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=qiwGK9NKR9zng2waAo5zTZuYYKgXgK/hMyrBttacMdQ=; b=gIjH0czRceIcDfnjwHJF1zRJPRelzCNjXtX6ZR+TVWE1JRmhoMMCMil5hN0l/KzXsg SvcHdFlYya6tV3gaLe5FJAhMp1skolYe926yboRshDU5QLQxeMFT4mMs39SahcmRb6L1 nWuOwXC33PJ1Ihp2jOo3AjaTy8FOzEEHd/luA00BcJ6+q/euOnsJTOzIxuPu3dm+FW6o vEanilZv2Ur8TVbKLweiOcvW1gnzqkFGc0r7iEwj8A53cStZoDhvU0TecHPW1IoyMOLG +m3N8TkmMgMXoPEPGv91VI5yqPTImGpUMISf7pM+mZp6rl/1XOX/XvpkMQVsdQY88GyR 5D0Q== X-Gm-Message-State: AHQUAuYHu1UjW0GOi2fVl4ew8SNnUaDaZSiQMCetngsNawUDSNKVJMRn xXTmGmm2+OxoVhQkmNfPMUMxZedulSw= X-Received: by 2002:a17:902:15a8:: with SMTP id m37mr1967911pla.129.1550117219337; Wed, 13 Feb 2019 20:06:59 -0800 (PST) Received: from localhost.localdomain (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id b25sm1119581pfi.72.2019.02.13.20.06.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 20:06:58 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 13 Feb 2019 20:06:52 -0800 Message-Id: <20190214040652.4811-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190214040652.4811-1-richard.henderson@linaro.org> References: <20190214040652.4811-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::641 Subject: [Qemu-devel] [PATCH 4/4] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.maydell@linaro.org, cota@braap.org, alex.bennee@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is the payoff. >From perf record -g data of ubuntu 18 boot and shutdown: BEFORE: - 23.02% 2.82% qemu-system-aar [.] helper_lookup_tb_ptr - 20.22% helper_lookup_tb_ptr + 10.05% tb_htable_lookup - 9.13% cpu_get_tb_cpu_state 3.20% aa64_va_parameters_both 0.55% fp_exception_el - 11.66% 4.74% qemu-system-aar [.] cpu_get_tb_cpu_state - 6.96% cpu_get_tb_cpu_state 3.63% aa64_va_parameters_both 0.60% fp_exception_el 0.53% sve_exception_el AFTER: - 16.40% 3.40% qemu-system-aar [.] helper_lookup_tb_ptr - 13.03% helper_lookup_tb_ptr + 11.19% tb_htable_lookup 0.55% cpu_get_tb_cpu_state 0.98% 0.71% qemu-system-aar [.] cpu_get_tb_cpu_state 0.87% 0.24% qemu-system-aar [.] rebuild_hflags_a64 Before, helper_lookup_tb_ptr is the second hottest function in the application, consuming almost a quarter of the runtime. Within the entire execution, cpu_get_tb_cpu_state consumes about 12%. After, helper_lookup_tb_ptr has dropped to the fourth hottest function, with consumption dropping to a sixth of the runtime. Within the entire execution, cpu_get_tb_cpu_state has dropped below 1%, and the supporting function to rebuild hflags also consumes about 1%. Signed-off-by: Richard Henderson --- target/arm/helper.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) -- 2.17.1 diff --git a/target/arm/helper.c b/target/arm/helper.c index 3c8724883d..1bdb87267e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13894,21 +13894,16 @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env, uint32_t el) void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { - int current_el = arm_current_el(env); - uint32_t flags; + uint32_t flags = env->hflags; uint32_t pstate_for_ss; *cs_base = 0; - if (is_a64(env)) { + if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { *pc = env->pc; - flags = rebuild_hflags_a64(env, current_el); - assert(flags == env->hflags); flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); pstate_for_ss = env->pstate; } else { *pc = env->regs[15]; - flags = rebuild_hflags_a32(env, current_el); - assert(flags == env->hflags); flags = FIELD_DP32(flags, TBFLAG_A32, THUMB, env->thumb); flags = FIELD_DP32(flags, TBFLAG_A32, CONDEXEC, env->condexec_bits); pstate_for_ss = env->uncached_cpsr;