accel/tcg: Add a quicker check for breakpoints
authorLeandro Lupori <leandro.lupori@eldorado.org.br>
Tue, 25 Oct 2022 20:24:22 +0000 (17:24 -0300)
committerRichard Henderson <richard.henderson@linaro.org>
Wed, 26 Oct 2022 01:11:28 +0000 (11:11 +1000)
commit69993c4e627a4e4d4d084bef643b446c97fee0f5
tree75ef9def31d6c9e4d7071d36b66759957534beab
parent122167659c50958f98cb2a153de97541f03462ff
accel/tcg: Add a quicker check for breakpoints

Profiling QEMU during Fedora 35 for PPC64 boot revealed that a
considerable amount of time was being spent in
check_for_breakpoints() (0.61% of total time on PPC64 and 2.19% on
amd64), even though it was just checking that its queue was empty
and returning, when no breakpoints were set. It turns out this
function is not inlined by the compiler and it's always called by
helper_lookup_tb_ptr(), one of the most called functions.

By leaving only the check for empty queue in
check_for_breakpoints() and moving the remaining code to
check_for_breakpoints_slow(), called only when the queue is not
empty, it's possible to avoid the call overhead. An improvement of
about 3% in total time was measured on POWER9.

Signed-off-by: Leandro Lupori <leandro.lupori@eldorado.org.br>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20221025202424.195984-2-leandro.lupori@eldorado.org.br>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
accel/tcg/cpu-exec.c