From: "Alex Bennée" <alex.bennee@linaro.org>
To: Richard Henderson <richard.henderson@linaro.org>
Cc: qemu-devel@nongnu.org, pierrick.bouvier@linaro.org
Subject: Re: [PATCH 0/2] tcg: Fix branch/label link during plugin expansion
Date: Fri, 13 Sep 2024 11:23:59 +0100 [thread overview]
Message-ID: <87jzffrgw0.fsf@draig.linaro.org> (raw)
In-Reply-To: <f7f1cb70-08f8-48aa-9db7-cc7a119a4234@linaro.org> (Richard Henderson's message of "Tue, 10 Sep 2024 14:28:15 -0700")
Richard Henderson <richard.henderson@linaro.org> writes:
> On 9/10/24 14:23, Richard Henderson wrote:
>> With tcg_last_op(), we always get the last op of the stream.
>> With TCGContext.emit_before_op, the most recently emitted op
>> is no longer the last op.
>> Instead, pass the op being emitted back from the allocator so
>> that we can link it to the label without needing to look it up.
>
> Oh, I meant to point out from whence this comes.
> The plugin uses a conditional
size_t n_insns = qemu_plugin_tb_n_insns(tb);
qemu_plugin_u64 quantum_insn =
qemu_plugin_scoreboard_u64_in_struct(vcpus, vCPUTime, quantum_insn);
/* count (and eventually trap) once per tb */
qemu_plugin_register_vcpu_tb_exec_inline_per_vcpu(
tb, QEMU_PLUGIN_INLINE_ADD_U64, quantum_insn, n_insns);
> ld_i32 tmp18,env,$0xffffffffffffdb10
> mul_i32 tmp18,tmp18,$0x18
> ext_i32_i64 tmp17,tmp18
> add_i64 tmp17,tmp17,$0x575410edadc8
qemu_plugin_register_vcpu_tb_exec_cond_cb(
tb, every_quantum_insn,
QEMU_PLUGIN_CB_NO_REGS, QEMU_PLUGIN_COND_GE,
quantum_insn, max_insn_per_quantum, NULL);
?
> ld_i64 tmp21,tmp17,$0x0
> brcond_i64 tmp21,$0x0,ltu,$L1
> ld_i32 tmp18,env,$0xffffffffffffdb10
> call plugin(0x79a2abfde66a),$0x1,$0,tmp18,$0x0
> set_label $L1
>
> Note that the branch is X < 0 (unsigned), which is always false, and
> thus the branch is optimized away.
I'm obviously missing something reading this. How can TCG know the state
of the scoreboard variables and optimise away the branch?
>
>
> r~
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
next prev parent reply other threads:[~2024-09-13 10:24 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-10 21:23 [PATCH 0/2] tcg: Fix branch/label link during plugin expansion Richard Henderson
2024-09-10 21:23 ` [PATCH 1/2] tcg: Return TCGOp from tcg_gen_op[1-6] Richard Henderson
2024-09-10 21:45 ` Pierrick Bouvier
2024-09-13 10:26 ` Alex Bennée
2024-09-13 20:50 ` Philippe Mathieu-Daudé
2024-09-10 21:23 ` [PATCH 2/2] tcg: Propagate new TCGOp to add_as_label_use Richard Henderson
2024-09-10 21:50 ` Pierrick Bouvier
2024-09-10 21:56 ` Richard Henderson
2024-09-10 21:28 ` [PATCH 0/2] tcg: Fix branch/label link during plugin expansion Richard Henderson
2024-09-13 10:23 ` Alex Bennée [this message]
2024-09-13 16:27 ` Richard Henderson
2024-09-18 18:43 ` Pierrick Bouvier
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=87jzffrgw0.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=pierrick.bouvier@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.