Landing goes beside the guards while mappings change; rectangles read without that lock

Pieces went through the title's address, guards opened, whenever the runtime was mapping pages, which is most of the time since they
are mapped in groups (28 of 1,620 pieces a frame beside the guards in run textures-4, 640 before): 5,000 blocks opened and 7,000
guarded a frame. VICTORY_LAND_ANYTIME=0: as before. The vertices of rectangle lists are read through the kernel at submission, not
under the lock the mapping holds.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
localandClaude Opus 5.5 committed 2026-11-25 05:32:52 -06:00
1 parent 6b07e2e02d
commit a0678ad1fa
2 files changed
+31 -7

No files matched your search

+8 -5
View File
@@ -3187,15 +3187,18 @@ impl State {
let (from, to, stride) = (from as usize, to as usize, stride as usize);
let n = rects as usize;
list.defer_host_read(from, n * 3 * stride, move || {
// The vertices are read in place, at submission: no change
// of mapping under the read (see
// `crate::watch::title_memory_reading`).
let _mapped = crate::watch::title_memory_reading();
// The vertices are read through the kernel, at submission; in
// place only if that fails, with no change of mapping under
// the read (see `crate::watch::title_memory_reading`): while
// the world streams a change is under way most of the time,
// and this is the thread that submits.
let mut read = vec![0u8; n * 3 * stride];
let held = (!crate::host::read_into(from as *const u8, &mut read)).then(crate::watch::title_memory_reading);
// SAFETY: the vertices lie in a title buffer (checked when
// recorded) and the scratch memory is the list's.
let (src, dst) = unsafe {
(
std::slice::from_raw_parts(from as *const u8, n * 3 * stride),
if held.is_some() { std::slice::from_raw_parts(from as *const u8, n * 3 * stride) } else { &read[..] },
std::slice::from_raw_parts_mut(to as *mut u8, n * 6 * stride),
)
};