[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 26/51] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state
From: |
Peter Maydell |
Subject: |
[PULL 26/51] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state |
Date: |
Thu, 24 Oct 2019 17:26:59 +0100 |
From: Richard Henderson <address@hidden>
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ée <address@hidden>
Reviewed-by: Alex Bennée <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
Message-id: address@hidden
Signed-off-by: Peter Maydell <address@hidden>
---
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 = env->hflags;
+ uint32_t pstate_for_ss;
*cs_base = 0;
- flags = rebuild_hflags_internal(env);
+#ifdef CONFIG_DEBUG_TCG
+ assert(flags == rebuild_hflags_internal(env));
+#endif
- if (is_a64(env)) {
+ if (FIELD_EX32(flags, TBFLAG_ANY, AARCH64_STATE)) {
*pc = env->pc;
if (cpu_isar_feature(aa64_bti, env_archcpu(env))) {
flags = FIELD_DP32(flags, TBFLAG_A64, BTYPE, env->btype);
--
2.20.1
- [PULL 18/51] target/arm: Rebuild hflags at EL changes, (continued)
- [PULL 18/51] target/arm: Rebuild hflags at EL changes, Peter Maydell, 2019/10/24
- [PULL 13/51] target/arm: Hoist computation of TBFLAG_A32.VFPEN, Peter Maydell, 2019/10/24
- [PULL 17/51] target/arm: Add HELPER(rebuild_hflags_{a32, a64, m32}), Peter Maydell, 2019/10/24
- [PULL 19/51] target/arm: Rebuild hflags at MSR writes, Peter Maydell, 2019/10/24
- [PULL 20/51] target/arm: Rebuild hflags at CPSR writes, Peter Maydell, 2019/10/24
- [PULL 21/51] target/arm: Rebuild hflags at Xscale SCTLR writes, Peter Maydell, 2019/10/24
- [PULL 22/51] target/arm: Rebuild hflags for M-profile, Peter Maydell, 2019/10/24
- [PULL 23/51] target/arm: Rebuild hflags for M-profile NVIC, Peter Maydell, 2019/10/24
- [PULL 24/51] linux-user/aarch64: Rebuild hflags for TARGET_WORDS_BIGENDIAN, Peter Maydell, 2019/10/24
- [PULL 25/51] linux-user/arm: Rebuild hflags for TARGET_WORDS_BIGENDIAN, Peter Maydell, 2019/10/24
- [PULL 26/51] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state,
Peter Maydell <=
- [PULL 27/51] hw/net/fsl_etsec/etsec.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 28/51] hw/timer/xilinx_timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 29/51] hw/dma/xilinx_axidma.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 30/51] hw/timer/slavio_timer: Remove useless check for NULL t->timer, Peter Maydell, 2019/10/24
- [PULL 32/51] hw/timer/grlib_gptimer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 34/51] hw/watchdog/milkymist-sysctl.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 31/51] hw/timer/slavio_timer.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 33/51] hw/m68k/mcf5206.c: Switch to transaction-based ptimer API, Peter Maydell, 2019/10/24
- [PULL 35/51] target/arm/monitor: Introduce qmp_query_cpu_model_expansion, Peter Maydell, 2019/10/24
- [PULL 36/51] tests: arm: Introduce cpu feature tests, Peter Maydell, 2019/10/24