xcl run: the crash report places every register in the title's memory #3628
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3628"
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?
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T01:06:04Z.
(Edited: head
4cff929d4, rebased with #3627's commit onmain395405e4c; this commit unchanged.)(Edited: head
095fdc694:crash_partreadsXCL_WINDOW_STATSwithout a first read that could wait (second review), on #3627's fixes. Onmain38ad22da.)Stacked on #3627 (
d3d12x/window-stats); only the top commit belongs here.An unhandled exception logged the page events at the pages the registers point into, and only where there were some. A crash where a register held an address in a memory window with no page events (memory the title corrupted in a coherent window, say) said nothing about where that address lay. Now each register that points into a memory window (sparse, coherent, view), a view of a pair or a graphics reservation gets one line: the region, the 64 KiB page, its page events, and what
XCL_WINDOW_STATScounted for its window when that is on. Other registers keep the line they had. Locks are only tried on this path, never waited for.Related, not the same: #1186 names the Windows memory state and UMA window of the faulting address; #3027 dumps the memory around readable pointers. This one places every register in XCL's own regions.
What is in it
eh.rs:register_lines, the lines for the registers, with the region, page events and counters passed in, so it is tested without a crash;title_region.hle/kernelx.rs:crash_region(graphics reservations) andmirrors::view_of(which view of a pair), both withtry_lock.hle/d3d12x/window_stats.rs:crash_part, the window's counters so far.Tested
095fdc694:cargo checkwith and without--tests, no errors; Under Wine on Mesa's CPU Vulkan driver, release, 1 run:cargo test --lib -- window_stats file_reads write_log shader_mem console_heap eh::at the top of the stack (#3642,f1ae90ebb): 62 passed, 0 failed.5653fd69, with an earlier version of this PR's commit, before the second review's fixes):cargo test --workspace -- --test-threads=4, 2,931 passed, 0 failed, 51 ignored, 1 run; 28SKIPPEDlines (wave64 tests: no wave64 on this card; heap-window tests withoutXCL_HEAP_WINDOWS=1; no D3D12 debug layer). The stack's GPU tests (gpu_mem_stats_*, the writer and geometry-pass tests) ran and passed.x86_64-pc-windows-gnu, release. Tests under Wine on Mesa's CPU Vulkan driver (no card: the card was running a title).cargo check -p xcl --release --target x86_64-pc-windows-gnu, with and without--tests: no errors, no new warnings.cargo test -p xcl --release --target x86_64-pc-windows-gnu --lib -- --test-threads=8 window_stats eh:: kernelx: 89 passed, 0 failed, 1 ignored in 1 of 3 runs; 88 passed and 1 failed in the other 2. Over all runs here, one of threekernelxtests that share process-wide state (an_address_keeps_the_page_the_title_mapped_there_last,a_page_whose_move_fails_stays_mapped_where_it_was,gpu_visible_fallback_memory_is_write_watched) failed in some runs and passed in others; the same tests failed the same way on the branch below this one, which does not touchkernelx. The new test,registers_into_title_memory_get_a_line_each_page, checks the lines for registers in a window, in a view of a pair, outside with page events, and repeated or small values.Regression run
RTX 2070 SUPER 8 GB (driver 621.01), Ryzen 7 5700X3D, Windows 11 Pro 26200, release builds by
scripts/smoke.ps1, the same retail title for 60 s each.main:this PR's head:
Not tested
AI use
main.Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T01:12:07Z.
Review (head
0a876d26, diff read, not a merge-check; draft, checks red):No problems found in the diff. Read the top commit
0a876d26only (register_lines,title_regionineh.rs,kernelx::crash_region,mirrors::view_of,window_stats::crash_part/totals_part) againstgpu::uma's window lookup, themirrorsstate layout andpagelog; the exception-filter path takes no blocking lock (try_lockonly,window_of/window/kindare lock-free),view_ofreads the(size, cpu)tuple the waysourcedoes, and the oldpage ofline stays for registers outside title memory. The stack on #3627 is declared. Still owed: thexcl-smokeblocks (the reasonPR descriptionis red) and a whole-suite run on a GPU; the tests ran filtered under Wine only.AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T03:00:33Z.
Follow-up review (head
bc55ba1f, since0a876d26, diff read, not a merge-check):bc55ba1f, only the hunk context inwindow_stats.rsmoved with #3627'sgiven_in. Thexcl-smokeblocks are now in (1669 vs 1620 frames, peak commit 110 %) andPR descriptionpasses; the whole suite has still not run on a GPU.New: none.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T13:47:09Z.
Follow-up review (head
67ac04a2, sincebc55ba1f, diff read, not a merge-check; checks red):git range-diffshows the own commit identical to the previous one; this push only rebases the stack onto the currentmain.New: none.
AI review: Claude Code (Claude Opus 5.5), posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:34:18Z.
Code review location:
crates/xcl/src/hle/d3d12x/window_stats.rs; line 216Medium:
log()(andon()at ~56) callcrate::gpu::uma::get(), which creates the UMA region on first call, instead ofuma::existing(), whose comment says "Observability must not allocate it."window_stats::start()runs inhost_mainbeforepreparation::before_guest, so with XCL_WINDOW_STATS=1 the stats thread wakes after 1 s while shader preparation is still running (which can take minutes) and callsuma::get(). That reserves the aperture and commits the coherent window (up to GBs of resident memory) on the stats thread long before the title would have, so a debug switch changes when and on which thread the title's memory is made. This comes from the stacked XCL_WINDOW_STATS commit. Note also that XCL_WINDOW_STATS=0 turns it on at 1 s (.max(1)) rather than off. Usingexisting()inlog()andon()would fix it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:34:18Z.
Code review location:
crates/xcl/src/hle/d3d12x/window_stats.rs; line 114Medium: Not certain about this one:
crash_partruns from the unhandled-exception filter and callsenabled()->seconds()->OnceLock::get_or_init. If that OnceLock was never set, it reads the environment and callsxlog_info!inside the crash path, and it can block on a concurrent initializer, against the PR's "locks are only tried, never waited for". In an early crash, or a process that installed the filter but skipshost_main'sstart(), the firstenabled()runs inside the filter, and if another thread is insideget_or_initat that moment the crashing thread waits on it, so the report may never be written. UsingOnceLock::get()there would avoid it.Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:34:18Z.
Review: COMMENTED
Review of
67ac04a2: 2 finding(s) (2 medium), most severe first.crates/xcl/src/hle/d3d12x/window_stats.rs:216:log()(andon()at ~56) callcrate::gpu::uma::get(), which creates the UMA region on first call, instead ofuma::existing(), whose comment says "Observability must not allocate it."window_stats::start()runs inhost_mainbef.... (inline)crates/xcl/src/hle/d3d12x/window_stats.rs:114: Not certain about this one:crash_partruns from the unhandled-exception filter and callsenabled()->seconds()->OnceLock::get_or_init. (inline)These findings come from an AI-assisted review (Claude Code) and focus on correctness. Each is a candidate; please check it before acting on it.
Imported from ivall/xcl. Originally posted by bmjask on 2026-12-02T16:34:20Z.
@Prime1997 could you take a look at this one for review and merge? My automated review notes are above, if any.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:47:03Z.
Code review location:
crates/xcl/src/hle/d3d12x/window_stats.rs; line 216Right on both.
log()andon()now takeuma::existing(), so the stats thread never makes the UMA region, andXCL_WINDOW_STATS=0is off (everyinwindow_stats.rs;zero_seconds_is_offfailed without it). The code is #3627's, so the fix is in its commit,2580976a; this PR's head is371b0fe2. Theexisting()change has no test: whether the region exists is process-wide, and the test process has already made it.AI use: Claude Code (Claude Opus 5.5) made the fix and wrote this reply.
Imported from ivall/xcl. Originally posted by Royalflamejlh on 2026-12-02T20:47:06Z.
Code review location:
crates/xcl/src/hle/d3d12x/window_stats.rs; line 114Right: nothing made sure
seconds()had been read before the filter ran.crash_partnow reads theOnceLockwithget()(SECONDSinwindow_stats.rs), so it neither initialises it nor waits on it; head371b0fe2. In #3630,crash_partalso no longer callsshader_mem::enabled()(anotherOnceLock):page_partalready returns nothing while the buffer pointer is null. No test: one test cannot arrange aOnceLockthat no other test has read.AI use: Claude Code (Claude Opus 5.5) made the fix and wrote this reply.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:04:38Z.
Follow-up review of
371b0fe2, since67ac04a2(code reading only, not a merge-check;PR descriptionred) · no new findingsIn short: Since
67ac04a2the PR's own commit has one change:crash_partreadsXCL_WINDOW_STATSthroughSECONDS.get()and no longer callsenabled(), which could run theOnceLockinitialiser inside the exception filter, wait on it and log from it. The rest of the push is #3627's commit underneath. The earlier reviews found nothing, and the new code adds no problem. Thexcl-smokeblock still names67ac04a2, not this head (PR descriptionis red), and the whole-suite GPU run is from an earlier head.Checked and fine
crash_part(window_stats.rs~123):SECONDS.get().is_some_and(Option::is_some)never starts the first read of the variable. If nothing has read it yet, the line gets no counters, which is right, since nothing was counted.SECONDSmoved from a localstaticto a modulestatic.seconds()still sets it once and logs once.uma::existing()isGLOBAL.get().mirrors::view_of,kernelx::crash_regionandpagelog::describeusetry_lock.register_lineskeeps the oldpage ofline for registers outside title memory, and skips values below0x1_0000and repeated 64 KiB pages.registers_into_title_memory_get_a_line_each_pagecovers each case.Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-02T21:33:49Z.
Follow-up review of
095fdc69, since371b0fe2(code reading only, not a merge-check;PR descriptionred) · no new findingsIn short: This push only rebases onto #3627's new commit. This PR's own commit is the same apart from context (
git range-diff). Nothing new. The smoke block names371b0fe2(PR descriptionis red).Checked and fine
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
Imported from ivall/xcl. Originally posted by Foniass on 2026-12-03T02:34:15Z.
Follow-up review of
4cff929d, since095fdc69(code reading only, not a merge-check) · no new findingsIn short: This push only rebases the stack onto
main. This PR's own commit is identical (git range-diff); the only change underneath is #3627 followingmain's newUploadCopyjobs. Nothing new, and nothing blocks it.Checked and fine
Written by Claude Code (Claude Opus 5.5) and posted by Foniass without a human check of each point.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.