From: "Alex Bennée" <alex.bennee@linaro.org>
To: Xudong Zhang <boxzxd@gmail.com>
Cc: qemu-devel@nongnu.org, qemu-arm@nongnu.org,
Peter Maydell <peter.maydell@linaro.org>,
Richard Henderson <richard.henderson@linaro.org>
Subject: Re: [PATCH] accel/tcg, target/arm: Close softmmu MTTCG cross-PE CMODX stale-TB races
Date: Thu, 03 Dec 2026 21:38:04 +0000 [thread overview]
Message-ID: <87se0eyrib.fsf@draig.linaro.org> (raw)
In-Reply-To: <20261203174513.167750-1-boxzxd@gmail.com> (Xudong Zhang's message of "Fri, 4 Dec 2026 01:45:13 +0800")
Xudong Zhang <boxzxd@gmail.com> writes:
> Close the softmmu MTTCG cross-PE concurrent modification and execution of
> instructions (CMODX) races required by the Arm Architecture Reference Manual for
> A-profile architecture (Arm DDI 0487, §B2.2.5 "Concurrent modification and
> execution of instructions" and §B2.4.4 (Issue M.d §B2.7.4) "Synchronization and coherency issues
> between data and instruction accesses") across three coupled mechanisms without
> altering guest-visible `CTR_EL0.DIC` live-migration ABI or introducing global
> stop-the-world `tb_flush()` calls:
> 1. Defer `TLB_NOTDIRTY` clearing and re-invalidate TBs after RAM stores commit
> in `accel/tcg/cputlb.c` (normal `do_st_*` and atomic RMW helpers), while
> synchronizing `physical_memory_is_clean()` checks under `tlb.c.lock` in
> `tlb_set_page_full()` and `tlb_set_dirty()`.
> 2. Protect newly translated code pages in `accel/tcg/tb-maint.c`
> (`tb_lock_page0()` / `tb_lock_page1()`) **before** `setjmp_gen_code()`
> reads guest instruction bytes, closing the fast-path-store vs. first-TB
> translation race.
> 3. Extend `ic_ivau_write()` in `target/arm/helper.c` to softmmu under MTTCG
> for AArch64 `IC_IVAU` and AArch32 `ICIMVAU`, closing both pre-protect
> in-flight fast-path stores and direct-RAM `probe_access*()` writes (such as
> SVE `ST1W`, `DC ZVA`, and MOPS) when followed by architectural `IC IVAU` /
> `ICIMVAU`.
>
> Reproducer: https://gist.github.com/canxin121/34f26564c3667e2b250becdd0b5a331f
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/5099
> Signed-off-by: Xudong Zhang <boxzxd@gmail.com>
> ---
> accel/tcg/cputlb.c | 156 ++++++++++++++++++++++++++++++++++---------
> accel/tcg/tb-maint.c | 31 +++++++--
> target/arm/helper.c | 68 ++++++++++++++-----
> 3 files changed, 204 insertions(+), 51 deletions(-)
NACK - this is an AI generated slop patch and isn't a carefully
considered approach to the locking around TB code generation.
--
Alex Bennée
Virtualisation Tech Lead @ Linaro
prev parent reply other threads:[~2026-12-03 21:38 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 17:45 [PATCH] accel/tcg, target/arm: Close softmmu MTTCG cross-PE CMODX stale-TB races Xudong Zhang
2026-12-03 21:38 ` Alex Bennée [this message]
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=87se0eyrib.fsf@draig.linaro.org \
--to=alex.bennee@linaro.org \
--cc=boxzxd@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.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.