From: BALATON Zoltan <balaton@eik.bme.hu>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: Matt Turner <mattst88@gmail.com>,
qemu-devel@nongnu.org, pbonzini@redhat.com, philmd@mailo.com,
zhao1.liu@intel.com, laurent@vivier.eu, deller@gmx.de,
pierrick.bouvier@oss.qualcomm.com
Subject: Re: [PATCH 1/8] accel/tcg: cache the result of curr_cflags()
Date: Wed, 19 Aug 2026 13:32:14 +0200 (CEST) [thread overview]
Message-ID: <3d7bf253-a7fb-614b-e1b4-1a4e57f81951@eik.bme.hu> (raw)
In-Reply-To: <bd54b977-fb6c-4e94-9863-745ce8133f96@linaro.org>
On Tue, 18 Aug 2026, Richard Henderson wrote:
> On 8/18/26 10:42, Matt Turner wrote:
>> curr_cflags() is called once per TB dispatch, from helper_lookup_tb_ptr()
>> and from the cpu_exec() loop. It recomputes the same value every time:
>>
>> uint32_t cflags = cpu->tcg_cflags;
>> if (unlikely(cpu_single_stepping(cpu))) { ... }
>> else if (qatomic_read(&one_insn_per_tb)) { ... }
>> else if (qemu_loglevel_mask(CPU_LOG_TB_NOCHAIN)) { ... }
>>
>> That is three loads and three branches on the hottest path in the
>> interpreter, for state that changes only when gdb enables single-step,
>> when one-insn-per-tb is toggled, or when the log mask changes.
>>
>> Compute the value once into CPUState::tcg_curr_cflags and recompute it
>> from the four places that can change an input: tcg_cflags_set(),
>> cpu_single_step(), tcg_set_one_insn_per_tb() and qemu_set_log_internal().
>> curr_cflags() becomes a single load.
>
> Certainly one_insn_per_tb can only be set from the command-line, so that
> should never have been handled along this path.
QEMU 11.1.50 monitor - type 'help' for more information
(qemu) help one-insn-per-tb
one-insn-per-tb [on|off] -- run emulation with one guest instruction per
translation block
Regards,
BALATON Zoltan
next prev parent reply other threads:[~2026-08-19 11:33 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 17:42 [RFC PATCH 0/8] accel/tcg: cut per-block dispatch overhead Matt Turner
2026-08-18 17:42 ` [PATCH 1/8] accel/tcg: cache the result of curr_cflags() Matt Turner
2026-08-18 22:45 ` Richard Henderson
2026-08-19 11:32 ` BALATON Zoltan [this message]
2026-08-18 17:42 ` [PATCH 2/8] accel/tcg: enlarge the TB jump cache to 64K entries Matt Turner
2026-08-18 22:46 ` Richard Henderson
2026-08-18 17:42 ` [PATCH 3/8] accel/tcg: skip the can_do_io stores in user-only builds Matt Turner
2026-08-18 22:47 ` Richard Henderson
2026-08-19 0:13 ` Philippe Mathieu-Daudé
2026-08-18 17:42 ` [PATCH 4/8] RFC: tcg: probe the TB jump cache inline instead of calling a helper Matt Turner
2026-08-18 21:51 ` Pierrick Bouvier
2026-08-19 0:10 ` Matt Turner
2026-08-18 22:26 ` Mohamed Mediouni
2026-08-19 1:03 ` Matt Turner
2026-08-19 0:34 ` Philippe Mathieu-Daudé
2026-08-18 17:42 ` [PATCH 5/8] RFC: accel/tcg: allow cross-page goto_tb chaining in user-only builds Matt Turner
2026-08-18 17:42 ` [PATCH 6/8] RFC: accel/tcg: only poll for interrupts in blocks that can close a cycle Matt Turner
2026-08-18 23:36 ` Richard Henderson
2026-08-18 17:42 ` [PATCH 7/8] RFC: accel/tcg: poison the jump cache instead of polling for indirect exits Matt Turner
2026-08-18 17:42 ` [PATCH 8/8] RFC: tcg: fold a guest displacement into the host addressing mode Matt Turner
2026-08-18 22:52 ` [RFC PATCH 0/8] accel/tcg: cut per-block dispatch overhead Richard Henderson
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=3d7bf253-a7fb-614b-e1b4-1a4e57f81951@eik.bme.hu \
--to=balaton@eik.bme.hu \
--cc=deller@gmx.de \
--cc=laurent@vivier.eu \
--cc=mattst88@gmail.com \
--cc=pbonzini@redhat.com \
--cc=philmd@mailo.com \
--cc=pierrick.bouvier@oss.qualcomm.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=zhao1.liu@intel.com \
/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.