You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The option is accepted because it only checks qemu_real_host_page_size == 16K, which holds on this host — but the code it enables is not compiled for the 64-bit target.
Two things combine (line numbers at master 48a9c55):
target/i386/latx/translator/translate.c:4581-4583 allocates three itemps at the top of gen_test_page_flag(), before the #if TARGET_ABI_BITS == 32 guard at :4602. On a 64-bit build the allocation happens on every memory access, while the 16K body that was meant to consume them is not compiled in.
target/i386/latx/translator/reg-alloc.c:295-310 makes ra_alloc_itemp()abort() when the pool is exhausted, so the graceful fallback immediately below it (translate.c:4584-4596, spilling into a0/a1/a2 via need_restore0/1/2) can never run — it is dead code under register pressure.
Suggested fix (either one):
move the three itemp allocations inside the #if TARGET_ABI_BITS == 32 guard, or
reject LATX_MT at option-parse time when TARGET_ABI_BITS == 64, with a clear message.
Found the root cause while reading the code: gen_test_page_flag() returns early when option_mem_test is 0 (the x86_64 build takes the #else return; branch), so the three itemps at translate.c:4581 are only allocated once LATX_MT is set — and on a 64-bit build nothing ever consumes them, so ra_alloc_itemp() exhausts and aborts. The minimal fix is to reject LATX_MT at option-parse time on 64-bit targets. Patch below (also fine to turn the warning into exit() if you prefer). Happy to open a PR with this if you'd like.
diff --git a/linux-user/main.c b/linux-user/main.c
index d37bd80..24cf674 100644
--- a/linux-user/main.c+++ b/linux-user/main.c@@ -842,6 +842,15 @@ static void handle_arg_latx_mem_test(const char *arg)
} else {
option_mem_test = value;
}
+#if TARGET_ABI_BITS == 64+ if (option_mem_test) {+ fprintf(stderr,+ "LATX_MT is not supported on the x86_64 target: "+ "16K-page guest-permission checks are i386-only. "+ "Ignoring LATX_MT.\n");+ option_mem_test = 0;+ }+#endif
if (option_mem_test) {
if (qemu_real_host_page_size != LATX_HOST_16K_PAGE_SIZE) {
option_mem_test = 0;
Thanks for the report. I reproduced the exhaustion on master 48a9c55 and opened #525 with a fix and a minimal regression test.
The fix keeps LATX_MT available on x86_64 and releases temporary registers that are no longer needed. In the TEST [mem], imm followed by CMOVNE reg, [mem] sequence, the TEST sources are no longer needed after flag calculation and the AND result have been emitted. Releasing them before translating CMOVcc avoids the exhaustion in this reproducer.
Activity
kong5021 commentedon Oct 24, 2026
Found the root cause while reading the code: gen_test_page_flag() returns early when option_mem_test is 0 (the x86_64 build takes the #else return; branch), so the three itemps at translate.c:4581 are only allocated once LATX_MT is set — and on a 64-bit build nothing ever consumes them, so ra_alloc_itemp() exhausts and aborts. The minimal fix is to reject LATX_MT at option-parse time on 64-bit targets. Patch below (also fine to turn the warning into exit() if you prefer). Happy to open a PR with this if you'd like.
LATX-X64, fix: Release TEST paired source temps
xiezyang commentedon Oct 26, 2026
Thanks for the report. I reproduced the exhaustion on master 48a9c55 and opened #525 with a fix and a minimal regression test.
The fix keeps LATX_MT available on x86_64 and releases temporary registers that are no longer needed. In the TEST [mem], imm followed by CMOVNE reg, [mem] sequence, the TEST sources are no longer needed after flag calculation and the AND result have been emitted. Releasing them before translating CMOVcc avoids the exhaustion in this reproducer.
LATX-X64, fix: Release TEST paired source temps