[Bug] LATX_MT=1/2 aborts immediately on x86_64 (itemp register exhausted, SIGTRAP)
Maintainers usually reply within 2 days
A pull request for this has already been merged.
- #525 by @xiezyang — merged
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- c
- Domain
- backend, operating-systems
Research direction
Start in target/i386/latx/translator/translate.c, at gen_test_page_flag(), and check where the itemp allocations sit relative to the TARGET_ABI_BITS guard. Then inspect ra_alloc_itemp() in target/i386/latx/translator/reg-alloc.c to understand the abort under register pressure. Reproduce with LATX_MT=1 or LATX_MT=2 on a 16KB-page LoongArch64 host; done means startup no longer aborts on the x86_64 target.
Written by the indexing model from the issue text.
Description
On a 16KB-page LoongArch64 host, setting LATX_MT=1 or LATX_MT=2 for the x86_64 translator aborts at startup:
[LATX] itemp register exhausted, status=0x7f
SIGTRAP (core dumped)
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-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 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-310makesra_alloc_itemp()abort()when the pool is exhausted, so the graceful fallback immediately below it (translate.c:4584-4596, spilling intoa0/a1/a2vianeed_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 == 32guard, or - reject
LATX_MTat option-parse time whenTARGET_ABI_BITS == 64, with a clear message.
Environment
- Host CPU: Loongson 3A6000 (LoongArch64)
- OS: Galaxy Kylin V10 SP1 2503, kernel
5.4.18-125-generic - Host page size: 16KB (
CONFIG_PAGE_SIZE_16KB=y) - Reproduced with both distro package
lat1.6.7 and locally built master48a9c55 getconf PAGESIZE-> 16384
Reproduce
LATX_MT=1 latx-x86_64 /opt/wine-stable/bin/wine64 'C:/npp/notepad++.exe'
LATX_MT=2 latx-x86_64 /opt/wine-stable/bin/wine64 'C:/npp/notepad++.exe'
Both abort immediately with the message above.
Happy to run any patch you suggest — this is a dedicated test box.
- Dominant language
- C
- Stars
- 246
- Forks
- 64
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 24
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from lat-opensource/lat
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
lat-opensource/lat#523 · 3 comments ·
Maintainers usually reply within 2 days
-
[Bug]: linux 微信无法启动May be free again @LaurenIsACoder claimed this 59 days ago, and no pull request is open. Openbug
lat-opensource/lat#465 · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug]: Proton Python 的内部 fd 闭环May be free again @LaurenIsACoder claimed this 60 days ago, and no pull request is open. Openbug
lat-opensource/lat#462 · 1 assignee ·
Maintainers usually reply within 2 days
-
[Bug]: Syringe.exe (injector of a Yuri's Revenge expansion platform called Ares) cannot workMay be free again @LaurenIsACoder claimed this 87 days ago, and no pull request is open. Openbug
lat-opensource/lat#380 · 2 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 3-5 days Newbie friendliness 15/100
lat-opensource/lat#374 ·
Maintainers usually reply within 2 days
All issues in lat-opensource/lat
Similar issues
-
luaebpf: the by-example page's intro names two outcomes of a lowering and omits the stop with the default verdictPossibly taken A pull request linked to this issue is open or already merged. Opendocumentation severity: low
Difficulty 1/5 Under an hour Newbie friendliness 88/100
luainkernel/lunatik#2231 ·
Maintainers usually reply within 1 day
-
aspect ratio 16:10Openenhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Revivedx/SavageWindRecomp#402 ·
Maintainers usually reply within 1 day
-
cleanup help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ESPresense/ESPresense#2602 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
apache/arrow-swift#209 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
libretiny-eu/libretiny#435 ·
Maintainers usually reply within 4 days