[PR #2124] [MERGED] dstorage: reads into physical pages wait for the title's Submit (DSTORAGE-HOLD-PAGE-READS) #2129

Closed
opened 2026-11-26 21:20:08 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2124
Author: @QemmHD
Created: 11/25/2026
Status: ✅ Merged
Merged: 11/26/2026
Merged by: @aslan2142

Base: main ← Head: claude/dstorage-hold-page-reads


📝 Commits (1)

  • 6b09de4 dstorage: reads into physical pages wait for the title's Submit

📊 Changes

4 files changed (+456 additions, -12 deletions)

View changed files

📝 docs/directstorage.md (+16 -2)
📝 runtime/shims/dstorage.cpp (+162 -10)
➕ runtime/src/dstorage_hold.h (+23 -0)
📝 runtime/test/dstorage_test.cpp (+255 -0)

📄 Description

A queue with auto-submit on submits itself once the entries enqueued since the last submit reach half its capacity (enqueue() → submit_locked()). A request into physical pages names its pages through DestinationPageArray, which the worker reads only when the request runs (publish() → page_transfer()). The title fills that page table just before it calls Submit. So a read started by the self-submit finds page 0 (the entry fails with E_INVALIDARG) or the page number the slot held before (the data lands in a page that now belongs to something else, with no error).

  • A self-submit stops at the first read into physical pages. That read and every entry behind it wait for the title's Submit, in order, so a status entry, fence or event behind a held read still comes after it.
  • A full queue submits the held entries, since the title cannot call Submit while it waits in an enqueue. Close submits everything, as before.
  • LEONIDA_DSTORAGE_HOLD_MS bounds a hold (2000 ms by default, 0 for no limit), so a path that never calls Submit cannot stall for good. LEONIDA_DSTORAGE_HOLD_PAGES=0 restores the old behaviour.
  • [rt] ds-hold counts self-submits, held reads, full-queue and timed releases, and page lists that were still empty when read.

Tests (Windows 11, RTX 4070 SUPER, VS 2022, Ninja)

  • dstorage_test with the new test_page_reads_wait_for_submit: 551 checks pass. With LEONIDA_DSTORAGE_HOLD_PAGES=0, 15 of them fail: the read lands in the page the list named before, and an empty list fails.
  • Full ctest: everything passes except the tests already flaky on this machine (xs_proxy_mock, d3d12_depth_resolve under the driver's MFAA setting). None of them build dstorage.
  • Consistency set: 597 passed; only the existing test_runtime_paths workflow check fails, as on main.

Idea from fxceless/victory-fork 79cfdd9 (after Marvisak/VIctory eddde73), written anew for this queue.

AI-assisted (Claude Code, Claude Opus 5.5).

🤖 Generated with Claude Code

https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2124 **Author:** [@QemmHD](https://github.com/QemmHD) **Created:** 11/25/2026 **Status:** ✅ Merged **Merged:** 11/26/2026 **Merged by:** [@aslan2142](https://github.com/aslan2142) **Base:** `main` ← **Head:** `claude/dstorage-hold-page-reads` --- ### 📝 Commits (1) - [`6b09de4`](https://github.com/ubiquitarianism/leonida/commit/6b09de493cef367f2fd48c1e73583a277732c9ff) dstorage: reads into physical pages wait for the title's Submit ### 📊 Changes **4 files changed** (+456 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `docs/directstorage.md` (+16 -2) 📝 `runtime/shims/dstorage.cpp` (+162 -10) ➕ `runtime/src/dstorage_hold.h` (+23 -0) 📝 `runtime/test/dstorage_test.cpp` (+255 -0) </details> ### 📄 Description A queue with auto-submit on submits itself once the entries enqueued since the last submit reach half its capacity (`enqueue()` → `submit_locked()`). A request into physical pages names its pages through `DestinationPageArray`, which the worker reads only when the request runs (`publish()` → `page_transfer()`). The title fills that page table just before it calls Submit. So a read started by the self-submit finds page 0 (the entry fails with E_INVALIDARG) or the page number the slot held before (the data lands in a page that now belongs to something else, with no error). - A self-submit stops at the first read into physical pages. That read and every entry behind it wait for the title's Submit, in order, so a status entry, fence or event behind a held read still comes after it. - A full queue submits the held entries, since the title cannot call Submit while it waits in an enqueue. Close submits everything, as before. - `LEONIDA_DSTORAGE_HOLD_MS` bounds a hold (2000 ms by default, 0 for no limit), so a path that never calls Submit cannot stall for good. `LEONIDA_DSTORAGE_HOLD_PAGES=0` restores the old behaviour. - `[rt] ds-hold` counts self-submits, held reads, full-queue and timed releases, and page lists that were still empty when read. **Tests** (Windows 11, RTX 4070 SUPER, VS 2022, Ninja) - `dstorage_test` with the new `test_page_reads_wait_for_submit`: 551 checks pass. With `LEONIDA_DSTORAGE_HOLD_PAGES=0`, 15 of them fail: the read lands in the page the list named before, and an empty list fails. - Full ctest: everything passes except the tests already flaky on this machine (xs_proxy_mock, d3d12_depth_resolve under the driver's MFAA setting). None of them build dstorage. - Consistency set: 597 passed; only the existing `test_runtime_paths` workflow check fails, as on main. Idea from fxceless/victory-fork 79cfdd9 (after Marvisak/VIctory eddde73), written anew for this queue. AI-assisted (Claude Code, Claude Opus 5.5). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01SR1Fv7eQNgZjM6miWPKjHf --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 21:20:08 +01:00
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2129
No description provided.