From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, peter.maydell@linaro.org, cota@braap.org
Subject: Re: [Qemu-devel] [PATCH v2 3/3] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state
Date: Wed, 20 Feb 2019 10:33:07 +0000 [thread overview]
Message-ID: <87zhqq4un0.fsf@zen.linaroharston> (raw)
In-Reply-To: <20190219233421.388-4-richard.henderson@linaro.org>
Richard Henderson <richard.henderson@linaro.org> writes:
> 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.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Tested-by: Alex Bennée <alex.bennee@linaro.org>
> ---
> v2: Retain asserts for future debugging.
> ---
> target/arm/helper.c | 20 +++++++++++++++-----
> 1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 909535a3e3..990a87876f 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -14034,19 +14034,29 @@ 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;
>
> +#ifdef CONFIG_DEBUG_TCG
> + {
> + int el = arm_current_el(env);
> + uint32_t check_flags;
> + if (is_a64(env)) {
> + check_flags = rebuild_hflags_a64(env, el);
> + } else {
> + check_flags = rebuild_hflags_a32(env, el);
> + }
> + g_assert_cmphex(flags, ==, check_flags);
> + }
> +#endif
> +
> *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);
> 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);
> 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;
--
Alex Bennée
next prev parent reply other threads:[~2019-02-20 10:33 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-19 23:34 [Qemu-devel] [PATCH v2 0/3] target/arm: Reduce overhead of cpu_get_tb_cpu_state Richard Henderson
2019-02-19 23:34 ` [Qemu-devel] [PATCH v2 1/3] target/arm: Split out recompute_hflags et al Richard Henderson
2019-02-19 23:34 ` [Qemu-devel] [PATCH v2 2/3] target/arm: Rebuild hflags at el changes and MSR writes Richard Henderson
2019-02-20 10:31 ` Alex Bennée
2019-02-19 23:34 ` [Qemu-devel] [PATCH v2 3/3] target/arm: Rely on hflags correct in cpu_get_tb_cpu_state Richard Henderson
2019-02-20 10:33 ` Alex Bennée [this message]
2019-02-20 0:03 ` [Qemu-devel] [PATCH v2 0/3] target/arm: Reduce overhead of cpu_get_tb_cpu_state no-reply
2019-02-20 0:07 ` no-reply
2019-02-21 21:21 ` Emilio G. Cota
2019-02-21 22:36 ` Alex Bennée
2019-02-21 22:59 ` Emilio G. Cota
2019-02-22 0:14 ` Richard Henderson
2019-02-27 15:28 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zhqq4un0.fsf@zen.linaroharston \
--to=alex.bennee@linaro.org \
--cc=cota@braap.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.