Repository navigation
Description
Summary
On a LoongArch64 host with 16KB pages, the x86_64 translator cannot run complex multi-threaded Windows GUI applications: the top-level window is created but never mapped and the main thread parks in futex_wait forever. The i386 translator on the same host, same Wine prefix and same Wine build runs the same applications perfectly.
While narrowing this down I found that the 16KB mixed-page compensation (latx_4k_page_flags, latx_16k_page_mixed, option_minke_16k_page_check, and the 16K branch added by #520) is compile-time gated to TARGET_ABI_BITS == 32, so the x86_64 target has no 16KB-page bookkeeping at all. I'd like to confirm whether that is the expected state and whether 64-bit 16KB support is planned.
Environment
All source line numbers below refer to upstream master 48a9c55.
$ uname -a
Linux user-pc 5.4.18-125-generic #114oemlx10u SMP Mon Oct 14 08:20:59 UTC 2024 loongarch64 loongarch64 loongarch64 GNU/Linux
$ getconf PAGESIZE
16384
| Item | Value |
|---|---|
| Host CPU | Loongson 3A6000 (LoongArch64), 8 cores |
| OS | Galaxy Kylin V10 SP1 2503, kernel 5.4.18-125-generic |
| Host page size | 16KB (CONFIG_PAGE_SIZE_16KB=y) |
| LATX (A) | distro package lat 1.6.7 |
| LATX (B) | master 48a9c55 (2026-10-21, contains #515 and #520), built locally with latxbuild/build-release.sh, version string lat-x86_64 48a9c55 |
| Wine | 10.0, WoW64 layout (bin/wine64 = x86-64, bin/wine = i386) |
| Display | Xvfb 1280x800x24 + openbox 3.6.1 (identical on a real Xorg display) |
| User VA | CONFIG_VA_BITS_40=y (1 TB user address space). Listed for completeness: simple 64-bit apps do run, so we do not believe this is the cause. |
Symptom
64-bit Windows GUI applications create a top-level window that is never mapped:
- Notepad++ 8.6.9 (PE32+ x86-64): window created as
115x1,Map State: IsUnMapped, process alive, no error output. Main thread blocked infutex_wait_queue_me(FUTEX_WAIT_PRIVATE, val=2); a second thread sits inpipe_read. - 7-Zip 24.08
7zFM.exe(x64) and SumatraPDF 3.5.2 (x64): same signature (2×futex_wait+ 1×pipe_read). - Wine builtin
notepad.exe(64-bit): window geometry is correct (752x536) butIsUnMapped; single thread inpipe_wait; screen stays blank before and after a click.
Screenshots of the root window are 279 bytes (single flat colour), i.e. nothing is rendered.
Control: the 32-bit path is healthy on the same host
| App | Bitness | Result |
|---|---|---|
7-Zip 24.08 7zFM.exe |
32-bit | IsViewable, full UI, menus open |
| Notepad++ 8.6.9 | 32-bit | IsViewable 1092x666, File menu drops down |
winemine |
32-bit | IsViewable, Chinese menu, grid rendered |
7z.exe CLI (add + extract) |
32-bit | Everything is Ok both directions |
| VLC 3.0.24 | 32-bit | window IsViewable, plays a local mp4, timer advances |
winecfg |
64-bit | renders fine (single-threaded GUI) |
clock, regedit |
64-bit | IsViewable |
So the failure is specific to complex, multi-threaded 64-bit guests on a 16KB-page host; 64-bit single-threaded GUIs and the whole 32-bit path are fine.
Source-level observation: 16KB mixed-page handling is 32-bit only
Everything that tracks the host-16K / guest-4K permission mismatch is compiled out for x86_64:
include/exec/cpu-all.h:246-256—latx_4k_page_flags,latx_16k_page_mixedand the whole declaration block sit inside#if TARGET_ABI_BITS == 32. (Understandable, sinceLATX_GUEST_PAGE_COUNTis1U << (TARGET_ABI_BITS - TARGET_PAGE_BITS), which is not usable for a 64-bit address space — but that means there is no sparse 64-bit equivalent either.)accel/tcg/translate-all.c:3124— the definition oflatx_4k_page_flags/latx_16k_page_mixed/latx_init_16k_page_checks()/latx_update_page_permissions()is under the sameTARGET_ABI_BITS == 32guard.linux-user/main.c:1564-1581— bothlatx_init_16k_page_checks()and the Minke check setup are inside#if ... TARGET_ABI_BITS == 32; andhandle_arg_latx_minke_16k_page_check()atmain.c:866-870explicitly forces the option back to 0 in the 64-bit branch.target/i386/latx/translator/translate.c:4602— the 16KB branch ingen_test_page_flag()(the code introduced by LATX, opt: Check guest permissions before mixed host-page fallback #520) is itself inside#if TARGET_ABI_BITS == 32, so it cannot apply to the x86_64 translator.
That would explain why #515/#520 changed nothing here: on this host the x86_64 target still performs no per-4K-page permission bookkeeping, so a guest 4K page sharing a host 16K page with different-permission neighbours can be over-protected (a legitimate guest write faults) or under-protected. We have not proven that this is what causes the futex/pipe hang. We are reporting the structural absence of bookkeeping and asking whether the hang is its expected consequence. One data point makes us unsure: we observe no SIGSEGV anywhere in the logs, which is what naive over-protection would normally produce.
LATX_MT cannot be used as a workaround on x86_64
LATX_MT=1 and LATX_MT=2 are accepted on the 64-bit binary (the option only checks qemu_real_host_page_size == 16K, which holds), but both abort immediately with
[LATX] itemp register exhausted, status=0x7f
and die with SIGTRAP (core dumped). Two things seem to combine here:
translate.c:4581-4583allocates three itemps at the top ofgen_test_page_flag(), before the#if TARGET_ABI_BITS == 32guard at 4602 — on a 64-bit build the allocation happens for every memory access while the 16K body that was supposed to consume them is not compiled in.reg-alloc.c:295-310makesra_alloc_itemp()abort()when the pool is exhausted, so the graceful fallback right below it (translate.c:4584-4596, spilling intoa0/a1/a2vianeed_restore0/1/2) can never run — it is dead code whenever the allocator is under pressure.
So LATX_MT is currently a landmine on x86_64 rather than a diagnostic.
Already ruled out
- CPU pinning:
taskset -c 0,-c 1,-c 2,-c 0-3, and no pinning at all — identical hang. - Translator version:
1.6.4,1.6.7(distro), master48a9c55built locally — identical hang. LATX_CLOSE_PARALLEL=1— no change.wineserver— healthy, idle indo_epoll_wait.- Display stack — Xvfb without WM, Xvfb + openbox, real Xorg
:0— identical. - Guest program — reproduced with Wine's own 64-bit
notepad.exe, so it is not specific to any third-party app.
Reproduce (minimal)
# 16KB-page LoongArch host, binfmt_misc x86_64 -> latx-x86_64
export WINEPREFIX=/data/latx-wine/default WINEARCH=win64
export LAT_LD_PREFIX=/opt/latx-wine/rootfs2
latx-x86_64 /opt/wine-stable/bin/wine64 'C:/npp/notepad++.exe'
# observe
xwininfo -root -tree | grep -i notepad # 115x1, IsUnMapped
for t in /proc/<pid>/task/*; do cat $t/wchan; done
# -> futex_wait_queue_me (main thread)
# -> pipe_waitQuestions
- Is the absence of any 16KB mixed-page bookkeeping on the x86_64 target intentional/known, or is a 64-bit (sparse) variant planned? If it is known, is the futex/pipe hang the expected consequence on 16K hosts?
- Should
LATX_MTbe rejected (or the itemp allocations moved inside the 32-bit guard) on x86_64, given it currently aborts at startup? - Is there a quick way for us to validate the hypothesis — for example a debug-only switch that enables 16K-page bookkeeping on the x86_64 target, even with a slow or sparse implementation where performance does not matter? We only need to know whether the hang disappears when bookkeeping is present.
I can provide per-thread wchan dumps, core files, or run any patch you suggest on this machine — it is a dedicated test box and we can iterate quickly.
Activity
kong5021 commentedon Oct 26, 2026
Correction: 16KB page size is not the differentiator - new suspect is 699471d
We opened this report blaming the 16KB host page size for the x86_64
futex/pipe hang. We now have direct evidence against that. Posting the
correction here instead of opening a new issue.
1. Page size is ruled out
Two machines, same CPU (Loongson 3A6000-HV), same 16KB page size, opposite
results:
PAGESIZE is 16384 on both machines. The page size cannot be the
differentiator.
[1] 1.6.4deepin1 is a packaging-only rebuild. The Debian changelog shows no
source changes to the translator, so it behaves as stock upstream 1.6.4.
2. The 16K code path is not even running
Our earlier source-level claim was also wrong. The 16K mechanism
(pageflags_root interval tree plus option_mem_test) is not guarded by
TARGET_ABI_BITS, and option_mem_test is off unless LATX_MT is set. It is
therefore not active during the failing runs. The 16K path is a red herring
here.
3. New suspect: commit 699471d
That commit rewrote gen_test_page_flag(). Before: three fixed registers
a0/a1/a7. After: three ra_alloc_itemp() calls plus a need_restore fallback.
Two things matter:
(a) ra_alloc_itemp() aborts instead of returning failure:
(b) the x86_64 itemp pool has only 7 entries:
4. The log matches bit for bit
The failing Kylin logs contain:
[LATX] itemp register exhausted, status=0x7f
itemp_status is a bitmask of the pool. 0x7f == 0b1111111 - exactly 7 bits,
all set. That is precisely the x86_64 pool size, fully exhausted. An i386
build with 11 slots could never print 0x7f.
5. Reverse test on 1.6.4
To confirm that the version is what matters, we forced the trigger on the
machine that works - LATX_MT=1 with Wine 10.14 under lat 1.6.4 - and the
64-bit GUI still came up fine, all windows IsViewable. 1.6.4 walks the same
path with fixed registers, so it is immune. This is consistent with
699471d being the regression point.
6. What we have NOT isolated yet
To be clear, this is a strong suspicion, not a proven root cause. Three
variables are still open:
The Kylin machine is currently down (a newer kernel fails to boot) and we
will report back once it is up again.
7. Questions for upstream
all, or is it effectively i386-only?
out early when TARGET_ABI_BITS == 64? The companion patch in issue [Bug] LATX_MT=1/2 aborts immediately on x86_64 (itemp register exhausted, SIGTRAP) #524
proposes exactly that, and we believe it is still worth merging as a
defensive fix.
given that ra_alloc_itemp() aborts rather than returning an error?
xiangzhai commentedon Oct 26, 2026
Hi,
Not reproduced:
https://github.com/Kron4ek/Wine-Builds/releases/download/11.20/wine-11.20-staging-tkg-amd64-wow64.tar.xz
Thanks,
Leslie Zhai
kong5021 commentedon Oct 26, 2026
Final update: you are right - this was a corrupted WINEPREFIX, not lat @//xiangzhai/ Thank you for taking the time to test this. Your "not reproduced"
result is correct, and we can now explain exactly why: the bug was never in
lat. It was in our WINEPREFIX.
We owe you an apology. Our first comment blamed 699471d / itemp exhaustion.
That was wrong - the "itemp register exhausted, status=0x7f" message came from
our own LATX_MT=1 experiment, not from the failing runs. We then chased a
second theory (16KB host page size, and host-page alignment in Wine's ntdll).
That was also wrong. We should have run a cross-variable experiment first.
Here it is. Same machine throughout - Kylin V10 SP1, kernel 5.4.18-125, 16KB
page size, lat 1.6.7, Loongson 3A6000-HV - two Wine builds crossed with two
prefixes:
pkill -9 wineserverandpkill -9 -f wine64invocations fromtry_map_free_area() mmap EINVALmessages we quoted earlier were a symptom