qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] util/cacheflush: Make first DSB unconditional on aarch64
@ 2025-03-10 20:36 Joe Komlodi
  2025-03-10 20:36 ` [PATCH 1/1] " Joe Komlodi
  0 siblings, 1 reply; 4+ messages in thread
From: Joe Komlodi @ 2025-03-10 20:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: slongfield, richard.henderson, pbonzini, komlodi

Hi all,

This fixes some TCG TB corruption we would occasionally see on aarch64
hosts in certain situations. Specifically, if the host had CTR_EL0.DIC
and CTR_EL0.IDC set, and if the TBs generated were very small, the
instructions in the TB would sometimes be garbage. This would mostly
result in a SIGILL when executing the TB, or sometimes a SIGSEGV if the
garbage instruction was to branch to a garbage address.

If a host has CTR_EL0.DIC and CTR_EL0.IDC set, the aarch64 cache
maintenance function doesn't execute a DSB, which seems to be the cause
of the corruption. I think it's because the ISB guarantees that the
instructions will be executed, but doesn't guarantee that any
outstanding writes will be fully committed.
This only seemed to happen on very small TBs, which I'm guessing is
because there's much fewer instructions between the TB being generated and
executed, which could lead to writes not being committed before execution.

This function is intended to be a copy of the upstream gcc one, which
does an unconditional DSB, so we can fix this by just doing that as well.

Thanks!
Joe

Joe Komlodi (1):
  util/cacheflush: Make first DSB unconditional on aarch64

 util/cacheflush.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.49.0.rc0.332.g42c0ae87b1-goog



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-12 14:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-10 20:36 [PATCH 0/1] util/cacheflush: Make first DSB unconditional on aarch64 Joe Komlodi
2025-03-10 20:36 ` [PATCH 1/1] " Joe Komlodi
2025-03-12 14:18   ` Peter Maydell
2025-03-12 14:32     ` Richard Henderson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).