From nobody Fri Dec 19 04:38:13 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1571753324; cv=none; d=zoho.com; s=zohoarc; b=m7ztEQe3HGIQoyK5lbda5iJ34M12/tJsnaSZ3481OF/4lLbusxzT59bz4avtem+KEIcLntSpTYTThCUnvD8IMdtKDBFOzzP6NczyZ1XpUOdwu84CkSfMubPxf1TbjMVLmqLYNe4po4RC4A7py4CWqWtGJUmeGhmAW7j607MQF+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571753324; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=bAJu0HC72frNdy2Inrafd6Q3Q7w56dol34p5z07V/hc=; b=NCeDCX4/SeoyQUq0GbTCbdd3IS9xm3hwrRXOUCb+aDvZnPzcvRHziUb+CoRRNVDB9HLoi2Kaqacy9sTA8IbDKxvtw4RcXXais6B8lQJ4wwSFvrB3YUaeSK096nKuHzEFLAVcKqvUJ/ByDvFU87rjbnQcwP2jNa4hwy57mZ9DLTU= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 157175332477618.56901040361015; Tue, 22 Oct 2019 07:08:44 -0700 (PDT) Received: from localhost ([::1]:58152 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuq3-0003wV-Nc for importer@patchew.org; Tue, 22 Oct 2019 10:08:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37156) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iMuHO-0003Pi-1D for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iMuHM-0001Xp-Ut for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:53 -0400 Received: from mail-wm1-x341.google.com ([2a00:1450:4864:20::341]:34651) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iMuHM-0001XW-OB for qemu-devel@nongnu.org; Tue, 22 Oct 2019 09:32:52 -0400 Received: by mail-wm1-x341.google.com with SMTP id v3so4016736wmh.1 for ; Tue, 22 Oct 2019 06:32:52 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [81.2.115.148]) by smtp.gmail.com with ESMTPSA id r2sm20263856wma.1.2019.10.22.06.32.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 06:32:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=bAJu0HC72frNdy2Inrafd6Q3Q7w56dol34p5z07V/hc=; b=Fx3oOz8hVXmznqwlID58U5J+ECC6nChMG4dBPMtJ0XgacjN1sjv6pTt0TxXo/z/6ec I5l5eIpPMF25TeHF9+ojkmdzs3kKVsFdVHkWTQvLGLCP7elcwWcMnl0p8dNUMVWLUVer +RHwTZa05fEfEh5lqcjF8C2DBIUbHqm0HtQSI3w39eVEKs8qaByaFHdxsfrL2gzM5i0I zoB+YEE7bEzxtOBEBj9uQ2/Pz4AZsX3omG+jb+J1tmowqMApjLwb9eBc609T5nvWb+mZ OR91PqNA2iY1RACLJO8L2mFxtUkkIw2EBVMtPjUxJEibsGZpLcQsRMs0AQvi72Fxz5PT C7+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bAJu0HC72frNdy2Inrafd6Q3Q7w56dol34p5z07V/hc=; b=V3DdgqFAI56FHJB0Z3iR7izhLFOGqNWD/iOAhczP3DY+4A0wjmOrHODQ6CBKOqjrly 22q9IFy0PQpxqjx1SX2OjXySX+vk7GYFh+AZ2YFHdcUgH3nNDBcWBK/JEGJB4k0wN7hB w271geN0YgBxzaxoME/PxjdNSbjpKYsyVusKkgdwYe0ozTwj7NlBoUYxKvbV2Ph0r7k5 mZ8d9B5gqUBDg0ghOGxSE53Z+eDXW4uC4WzdOTWKZCZy2zdzyE+GSfGpbjo5ki2hhlPa 2JTTG7Dw7VqlCr0loMYR1I8F5BoeC4qxogxUz7myW3ApgMcYfZg5iVnLus5gsAAB0apR RusQ== X-Gm-Message-State: APjAAAXGSeRwPU7FkVddjvwNLVxb5mkU76FyZCPLWpNztp29DzILEIyb HL2lzXk41ReyoKdyzwYxRZbSMwz60RA= X-Google-Smtp-Source: APXvYqySNU57AN1KrFBXkzI6++zB7X3RZW91hvvHIqZxD2fYtC5ybK2H0gZMuAFcrPO5TPAbE+Cx3g== X-Received: by 2002:a1c:a9cb:: with SMTP id s194mr3311303wme.92.1571751171251; Tue, 22 Oct 2019 06:32:51 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 32/41] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state Date: Tue, 22 Oct 2019 14:31:25 +0100 Message-Id: <20191022133134.14487-33-peter.maydell@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191022133134.14487-1-peter.maydell@linaro.org> References: <20191022133134.14487-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::341 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @linaro.org) From: Richard Henderson 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%. Assertions are retained for --enable-debug-tcg. Tested-by: Alex Benn=C3=A9e Reviewed-by: Alex Benn=C3=A9e Signed-off-by: Richard Henderson Message-id: 20191018174431.1784-23-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index c55783e5406..63815fc4cfc 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11259,12 +11259,15 @@ void HELPER(rebuild_hflags_a64)(CPUARMState *env,= int el) void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { - uint32_t flags, pstate_for_ss; + uint32_t flags =3D env->hflags; + uint32_t pstate_for_ss; =20 *cs_base =3D 0; - flags =3D rebuild_hflags_internal(env); +#ifdef CONFIG_DEBUG_TCG + assert(flags =3D=3D rebuild_hflags_internal(env)); +#endif =20 - if (is_a64(env)) { + if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) { *pc =3D env->pc; if (cpu_isar_feature(aa64_bti, env_archcpu(env))) { flags =3D FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype); --=20 2.20.1