[docs] (P7): ID-P7-46 - M2 round 2 lands on the integrator's own review, the memo handle-reuse ABA is closed

This commit is contained in:
2026-09-22 23:02:07 -04:00
parent 1ab62ece4c
commit be764a56d7
5 changed files with 28 additions and 12 deletions
@@ -0,0 +1,14 @@
# Review: M2 round 2 (pipe 4d207468 959ebc9e 6e18acaa 5ba34fcf + integrator f62703e9 1ab62ece) — integrator (Fable 5.1, main session)
**Verdict: land** (no change required before push; one cost recorded in CONTRACT-P7 §12 as M3's denominator).
The must-fix from round 1 (memo handle-reuse ABA) is closed the way the review asked: `VkBufferManager::m_wireStoreDestroyEpoch` is bumped on every path that destroys a wire store's VkBuffer and never reset; `UniformManager` folds it into the descriptor-reuse signature (`mix64(epoch)`) and records/compares it in `FastRebindMemo`, all under `MOBILEGL_BUILD_DISAGGREGATED`.
Verified on the pipe source, not the note:
1. Every destroy site is covered. `DeferWireRelease`'s immediate destroy (`buffer.Destroy(); ++epoch`), `SweepDeferredWireReleases` (returns at `dead == 0` BEFORE the bump, so a sweep that freed nothing does not defeat the memo on the next draw), `DestroyAllDeferredWireReleases` (bump iff non-empty), `Shutdown`'s `m_wireBuffers.clear()` (bump iff non-empty). `DestroyWireBuffer` moves the store into `DeferWireRelease` and only then erases the record, so the erase destroys nothing. The seven remaining `buffer.Destroy()` calls in the file are the non-wire records, which still die at the frame boundary that clears the memos.
2. The epoch is the destroy count's parity, not the slice epoch: `m_sliceEpochCounter` moves on every `WriteWireBuffer` and would miss on every `glBufferSubData`; the destroy epoch moves ~26k times over bsl's 1.3M calls. Cost = one extra descriptor-set acquire+write on the first draw after each destroy event, which also feeds §6.1's in-frame descriptor-set growth (M3).
3. `FastRebindMemo` aggregate initialiser order matches the struct (epoch last, guarded on both sides); the wire arm never takes the fast rebind (`SetupWireDraw` passes no sampler hint), so the signature half is the one the scenario reds through; the memo half is defensive and costs nothing.
4. The red-once is deterministic by construction (no sleep, no fence-poll race): orphan → flush-without-wait → a staged copy keeps the recording pending so the blocking wait cannot take the memo-clearing drain → the next park's sweep destroys S1 → a 64 KiB mint through the freed handle cannot alias the 256-byte hole a 1 MiB pin bounds → the draw reads the dead store's colour without the epoch. Both arms red at base, green with the guards; the note's static-link finding (the Split arm runs the backend compiled into the test binary) is worth keeping for every future red-once.
5. Integrator additions: `RespecifyWireBuffer` clears B3's `lastUseSubmitIndex` beside `lastUseSerial` (pipe-only field; the create path already zeroes it at :303, so 0 = never submitted); the parity exception list on pipe is keyed by exact tail (two merges ago) so the fourth Reclaim case is named there (the package branch excepts by prefix). `ServerSpawn` keeps `SPIN_US` / `SERVER_AFFINITY` / `AUDIT` for the child (tuning / audit values, no endpoint, role, path or size; ServerMain's catch (b) still verifies its four).
Gate on f62703e9: unit 2436, split 304, spawn 220, tcp 223, magma 101 / 80 / 71, full-split 539, G1 `.text` 0xa52203 nm +0/-0, census 79, ratchet 173, wire-declines 53/53/0 + 16/16, OpenRA DirectVulkan inproc + spawn ssim 1.000000 / 0 unsound lines, verify lanes 1150 / 1084; parity 0 errors after 1ab62ece.
@@ -48,4 +48,5 @@
| ID-P7-43 | 2026-09-22 | **M2 审查 = land with fixes,含一条 must-fix;集成者会话收尾并交接。** M2 审查(fable):**must-fix** = 中帧 use-after-free 的新可达点——M2 让孤儿 wire store 在帧中被销毁,而 `UniformManager` 的 `FastRebindMemo` 按裸 `VkBuffer` 句柄命中、descriptor-reuse memo 的签名混入 `VkDescriptorBufferInfo` 字词,二者都不看 epoch;句柄被堆复用后同一 program 的下一次 draw 命中旧 descriptor set → 静默错 UBO / SSBO 字节、无 Fatal(base 上 wire store 只在 `BeginFrame`/drain 死,与 memo 清空配对,M2 打破了配对)。修法 ~10 行:`VkBufferManager` 的 `m_wireStoreDestroyEpoch` 在每条销毁路径上自增,`UniformManager` 的两个 memo 带上 / 混入它(disagg 守卫内)——在 M2 分区之外,**集成者按 §9 批准例外**,已派 **M2 r2**(fable);同轮:note §0 引用改 pipe SHA、`VkBufferManager.h` 的「floor 非证明」去掉过期理由、case 3 单侧断言补 `ASSERT_GE`、「never decreases」注释、`RespecifyWireBuffer` 清 `lastUseSubmitIndex`、`ServerSpawn.cpp` 清洗名单补 `SpinUs/ServerAffinity/Audit`。审查确认:提前释放的三个条件健全(每条把 store 交给 GPU 的路径都打 `lastUseSerial`;park tag ≥ B3 的 `lastUseSubmitIndex`;`IsSubmitIndexComplete` 拒绝未提交索引;空闲判定真)、水位线同线程无跨线程等待、失败漏斗同族一处 abort、计量 / 配置全在 push / disagg 守卫内、descriptor-set 归因成立(VMA 子分配,M1 的「一 VkBuffer 一 memfd」不可能)。**用户令收尾**:让在跑的 agent 跑完并把报告写到 `~/w7/notes/handoff/`,机械未完项写进 [`HANDOFF-2026-09-22.md`](HANDOFF-2026-09-22.md)(M2 r2 落地 → p7w6 + 手机 server 重部署 → bsl 验收 / 窗口 1b 对照 / 门 3 终局 → M3 → B4 → F2 → wave 3 棘轮 88 → wave 4 CTS AFTER → wave 5),交给其他 agent。 | 推送集成树头(门全绿;M2 的 must-fix 由 M2 r2 关闭,在此之前 wire 臂有一处已知可达的 memo ABA)。 | `UniformManager.{h,cpp}`、`VkBufferManager.{h,cpp}`、`HANDOFF-2026-09-22.md` |
| ID-P7-44 | 2026-09-22 | **用户叫停 fable 审查代理,改由集成者本人审查。** F 修复轮 = **land**(两 nit 记债:`RunSession` 里 `Accept()` 返回到 `close(sourceFd)` 之间已转发的一条 DataBind 会随队列被关而无具名拒绝,微秒级窗口;`protocol.fbs` 任何字节变化都要 bump,严格但有意);B3 修复 r3 + B2 r4 = **land**(审计跨 `#endif` 只认整行 disagg 守卫、任意缩进 `#else` 停走;`EVIDENCE` 三种空模式都拒;模式位 100755;窗口腿底色品红 / 0.625 独一;门控只看 transport)。审查文本在 `notes/handoff/review-f-fix.md`、`review-b3r3-b2r4.md`(仓库与 WSL `~/w7/notes/handoff/` 各一份)。 | 集成树头已推送;余下机械项见 HANDOFF。 | `notes/handoff/` |
| ID-P7-45 | 2026-09-22 | **X2 落地**(pipe,test-only):`InitialCapsStartup.*` 与 `SocketTransportTest` 的 TCP 用例在负载下偶红的真因是**夹具**按 accept 顺序配对两条 loopback 连接,而内核在负载下会乱序交付(裸 socket 探针:空闲 0/2000、20 个 CPU 占用者下 5/3000)——对端把数据套接字当控制用,`StreamLink` 读到 `MGLD` 魔数外的首帧 → `Fatal{ProtocolCorruption,"StreamLink"}`;夹具改用产品的 DataBind nonce 会合(PH-7 (4) 形状),三例 0/500;无产品字节变化,G1 恒等。域外债:`AcceptPair`/`ConnectTo` 对 `tcp://` 监听仍可调且按顺序配对(产品从不这样用),未具名拒绝。 | pipe unit 车道全绿后推送;`~/w7/notes/handoff/x2-caps-flake.md`。 | `InitialCapsStartupTest.cpp`、`SocketTransportTest.cpp` |
| ID-P7-46 | 2026-09-22 | **M2 r2 落地(集成者本人审查 = land,must-fix 关闭)**:`VkBufferManager::m_wireStoreDestroyEpoch` 在四条销毁 wire store 的路径上自增(`DeferWireRelease` 即时销毁、有销毁的扫描每次一跳、`DestroyAllDeferredWireReleases`、`Shutdown` 清 record 持有的 store),永不复位;`UniformManager` 的 descriptor-reuse 签名 `mix64(epoch)`、`FastRebindMemo` 记录并比对(全在 disagg 守卫内;§9 分区例外已批);第四条 Reclaim 用例(一帧内 orphan → 不等待的 flush → 一条 staged copy 挡住清 memo 的 drain → 下一次停放的扫描销毁 S1 → 64 KiB 经同一句柄值铸造、放不进 1 MiB pin 封住的 256 B 洞 → draw)red-once 两臂读到死 store 的颜色,加守卫后绿。集成者核对:扫描在 `dead == 0` 先返回、不空跳 epoch;`DestroyWireBuffer` 先 move 进 defer 再 erase;文件里其余七处 `buffer.Destroy()` 都是非 wire record;`FastRebindMemo` 聚合初始化顺序与结构体一致。pipe 独有一行:`RespecifyWireBuffer` 顺带清 B3 的 `lastUseSubmitIndex`(`f62703e9`);`spawn_lane_parity.py` 的具名例外表补第四条 tail(`1ab62ece`;包分支按前缀例外、pipe 两次合并后按精确名——门上唯一的一条 parity 红就是它);`ServerSpawn` 放行 `SPIN_US` / `SERVER_AFFINITY` / `AUDIT`。**代价记 §12(M3 的分母)**:每次销毁事件后同 program 第一笔 draw 多一次 descriptor set 分配 + 写(bsl ~2.6 万 / 130 万)。方法学:`MobileGLIntegrationTest` 桌面上静态链接 `MobileGL_s`,Split 臂跑的是编进测试二进制的 backend——red-once 变体必须三个目标都建。 | 门(`f62703e9`):unit 2436、split 304、spawn 220、tcp 223、magma 101 / 80 / 71、full 539、G1 恒等、普查 79、棘轮 173、审计 53/53/0、OpenRA inproc + spawn ssim 1.0 / 0 unsound、verify 1150 / 1084;parity 0(`1ab62ece`);推送。审查文本 `notes/handoff/review-m2-r2.md`。 | `VkBufferManager.{h,cpp}`、`UniformManager.{h,cpp}`、`MagmaWireReclaimScenario.cpp`、`ServerSpawn.cpp`、`spawn_lane_parity.py` |
| ID-P7-19 | 2026-09-22 | OpenRA 真机分歧改判为 **wire 臂的 GPU 时序竞态**(冷驱动缓存 = 慢 pipeline 创建 → 最终帧回读在最后几批 draw 完成前采样),归 wave 2-B 第 0 片;主机 red-once 用 pipeline 创建延迟旋钮复现;真机验收 = 三次 `pm clear` 冷跑 1.0。F1 保留(机制正确)但不再被当作分歧原因。 | E7:`pm clear` 三遍 0.976493989 / 14658 逐字相同、热跑 1.0、冷 monolith 1.0、`FRAMESINFLIGHT=1` 一绿一红;两臂 client/server 日志逐行相同;diff 只缺最后画的对象。 | `WireFramebuffer.inc`、`VulkanRenderer.cpp`、`F1-verify/README.md` |