[pr-diagnostics][memory] DARNER_LAND_READS: name the code places that touch landed pages first #300
Loading…
Reference in a new issue
No description provided.
Delete branch "Yorivel/Darner:pr/land-read-places"
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?
Refs #287
Contributor role (optional)
What it changes
DARNER_LAND_READS=1counts first touches of landed pages by our code and by other code, but says nowhere which code. In my runs "by ours" was 85 % of the watched pages a frame with no way to tell which path, and the title's copies throughvcruntime140'smemcpyall showed up as one place in the C runtime.Each first touch is now noted by the code's place (module and offset, through
readwatch::module_of, madepub(crate)for this):vcruntime140'smemcpy/memsetis put on its caller (they are leaves, so the caller's return address is at the stack pointer), and logged as "read through VCRUNTIME140.dll+0x...".The handler only adds a map entry per fault (one lock); nothing else changes, and nothing runs with the switch off. README's row for the switch says so.
With it, "ours" turned out to be
darner_safe_copy_atalone (named from the PDB withllvm-symbolizer), that is, the next landing's merge reading title memory before it stores: those pages were not read by anything between two landings. Results in #287.How it was tested
f3840d7with #185 merged, release build (gates below are on this branch,8792ecf).DARNER_LAND_READS=1runs in the open world. Places logged as above; first touches over a whole run: title 1.1 %, our next landing 85.2 %, landed in again untouched 13.7 %.DARNER_LAND_READS=1, off by default).8792ecf: gates 1 and 2 (both clippy runs) pass. Gate 3: every crate passes exceptdarner-gpu's library tests, which are flaky in the full parallel run, and not from this change (it touches nowatchcode): on this branch 1 of 3 full runs passed, the other two each failed a differentwatch::test (tests::ask_once_by_res_splits_reservations_without_refusals,watch_pipe_epoch_tests::ask_once_delta_reask_direct_carves_refreshes_and_updates_page_epochs), both of which pass when run alone (5 of 5); onmainf3840d7the same suite did not finish: one test kept a core busy for over 15 minutes and I stopped it. #224 and #261 look at stalls and chance failures in these tests.shadowhad moved host copies of 8-byte buffers on that page into the card's memory ("a buffer's host copy is in the card's memory"). The census no longer held the page, so its handler passed the fault on. Details in #287; not fixed here.Checklist
main.docs/asset-policy.md.Checked for overlap
land/reads.rsorreadwatch.rs; #58 and #37 changeland.rs, which this does not.🤖 Generated with Claude Code
Independent Windows build, gate, and code-read review of
8792ecf7562c(full head8792ecf7562c72a25e4007918e9735ecbf8669f8), based onmainf3840d73d3504c30218debfbc8795b9225447317. Not run in-game.Environment
x86_64-pc-windows-msvc), MSVC 19.44.35230.Measured results
cargo clippy --workspace --all-targets --locked -- -D warnings): PASS.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings): PASS.cargo xtask policy: PASS (asset policy: 555 files ok).cargo test --locked -p darner-gpu --lib land::reads::tests: PASS (1 passed; 0 failed; 0 ignored; 1836 filtered out).cargo test --locked -p darner-gpu --lib readwatch::: PASS (2 passed; 0 failed; 0 ignored; 1835 filtered out).Code-read audit
DARNER_LAND_READS=1remains opt-in (land/reads.rs:46); the landing path callswatchonly for pages collected while that option is enabled (land.rs:672-739). The new site map keys code address, access type, and intercepted runtime address, and accumulates counts plus the first touched MiB (land/reads.rs:85, 276-277).vcruntime140.dllimage range and otherwise retains the faulting instruction address (land/reads.rs:213-220, 256-264).module_ofresolves the module filename used in formatted locations (readwatch.rs:318-340); the focused landing and readwatch tests pass.Finding
log_sitesdefines “ours” only as the Darner image range (land/reads.rs:350-353) and emits"title code touched"for every site outside that range (land/reads.rs:360-366). This includes any other loaded DLL or runtime caller, not just the game executable. That can give a false source attribution in the diagnostic this PR adds. Either identify the title executable separately for this message, or label the category as non-Darner/process code; keep the existing broader “other code than ours” wording where that is what the count represents.Verdict: CHANGES NEEDED.
AI-assisted: yes (GitHub Copilot, Auto mode).
Thanks for the review. You're right: everything outside Darner's image was labelled "title code".
Fixed in
0a950b7: the first-touch line now reads "code other than ours touched a page a landing put in, first time from here", matching the count it belongs to, and the doc comment and README row say that "other code" is any module but Darner's (the game's own image isdarner-image-*.dll, its DLLs, or the C runtime when no caller is found). Each place was already named by its module in thecodefield, so nothing else changes.Gates on
0a950b7:cargo xtask policy(555 files ok), gate 1 and gate 2 pass;cargo test --locked -p darner-gpu --lib land::reads(1 passed) andreadwatch::(2 passed). The full workspace suite was not rerun for this wording change.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.