mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:40:52 +01:00
[PR #2131] runtime tests: race a reader thread only once it reads (RT-TESTS-READER-START) #2138
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#2138
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/2131
Author: @syfyra
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/runtime-tests-wait-for-reader📝 Commits (1)
7ae40f9runtime tests: race a reader thread only once it reads (RT-TESTS-READER-START)📊 Changes
2 files changed (+8 additions, -0 deletions)
View changed files
📝
runtime/test/xmem_test.cpp(+5 -0)📝
runtime/test/xs_proxy_mock_test.cpp(+3 -0)📄 Description
Claimed in the coordination issue as: RT-TESTS-READER-START (claim comment to follow)
What and why
Two CPU tests start a reader thread and race it at once, then require that it read at least once:
runtime/test/xmem_test.cpptest_split_under_reader: 2,046 single-page unmaps, each splitting the view the reader reads from;runtime/test/xs_proxy_mock_test.cpp, thekernel_writestear check: 200,000 8-byte stores against a reader that looks for a torn value.On a loaded host (
ctest -j, a busy CI runner) the racing loop can finish before the reader is first scheduled.readsstays 0 and the check fails with nothing wrong in the runtime:FAIL the reader of the views' last pages never faults or misreadsxs_proxy_mock line 4487: g_tear.torn == 0 && g_tear.reads > 0When the reader gets a single read in first, the test passes having checked almost nothing. The remap race test above
test_split_under_readeralready waits for its four writers for this reason ("The remaps can finish before a writer is scheduled on a fast host"). Both tests now wait for the reader's first read the same way;xmem_testalso prints its read count, as the remap race test prints its write count. Test-only change.Tested
Windows 11, MSVC 14.44 (Build Tools), Ninja, RelWithDebInfo; the CPU tests (configured without Vulkan headers, with #2083's CMake fix applied locally so the configure succeeds):
xmem_testwithLEONIDA_WRITE_WATCH=0under 32 busy processes on 8 cores, 8 runs each:main: 1 failure (0 reads), 5 passes with exactly 1 read, 2 with more;ctest -j 8(162 tests): onmainxs_proxy_mockfailed in 3 of 3 runs (the tear check); with this branch 3 of 3 runs pass 162/162. (A fourth run failed onlyxmem_test's system-wide commit check, which #1316 addresses.)scripts/check_no_game_data.pyon both files.GPUs tested: n/a (CPU tests)
AI-assisted: yes (Claude Code, Claude Opus 5.5)
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a: no translator change)🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.