mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 15:33:22 +09:00
Two things land together: the plan and contract draft P6 needs before it starts, and the
working notes that until now existed on exactly one machine.
1. P6's plan and contract draft (neither started; not one line of code)
docs/Disaggregated/P6-SPAWN-PLAN.md the package plan
docs/Disaggregated/P6-CONTRACT-DRAFT.md the contract draft (moves to
MG_Remote/CONTRACT-P6.md when c6 lands)
The three findings that mattered, all written into the documents:
a. P6 is SMALLER than its roadmap cell suggests. The transport primitives are already in
the tree and already tested: SocketDoorbell including hangup detection and the two
lost-wakeup fences (Doorbell.cpp:211-360, four cases in FdPassingTest), SCM_RIGHTS fd
passing, ShmSegment::Adopt, and the SurfaceOp / WindowKind schema already defined in
protocol.fbs. inproc uses a real second shm mapping rather than an alias, and
SessionRings.h:22-28 says that was done so today is not the first time it runs. P6 is
assembly plus a control plane plus a process, not "write a socket transport".
b. The evidence for "P6 is only a transport swap" has EXPIRED. It was bought by P5c, whose
audit found 59 direct memory accesses in a tree that already looked clean. P5e changed
the tree again. So the first package, a6, is a read-only audit that writes no code, and
every contract row that depends on it is marked PENDING a6 rather than decided in
advance.
c. P6 does not get a game running on the phone. ANativeWindow* is meaningless in the child,
and protocol.fbs:186-196's own comment says Android transfers the window out of band -
that band is P12. P6 lands pbuffer / surfaceless / offscreen, which is what HeadlessGL,
the split-equivalent lane and trace replay need, and which is exactly what P6's own exit
gate measures. A real window reaching the server is a named refusal. This gets its own
section because "P6 is done" would otherwise read as "the game runs now".
The contract adds rule G: a role may not name a process-local handle. It extends P5c's
rule E (a role may not name the other role's memory) from memory to identity - EGLDisplay /
EGLSurface / EGLContext / ANativeWindow* / fd number / pid / mapped address either cross as
a token this contract defines or they do not cross, and a descriptor crosses only through
SCM_RIGHTS, where the kernel renumbers it.
What P5e left for P6 gets its own section. The latch semantics are already designed
(ARCHITECTURE.md:504) and are copied unchanged. What is new is that after run-ahead the
client no longer waits while the peer process can DIE: the client holds records that were
published and will never be applied, and Android's freezer suspends the child without
closing anything. So slow and dead must be distinguishable WITHOUT a timeout threshold.
That is P6's only new design; everything else is carriage. It shares a predicate with E1's
outstanding re-specification (ID-122), and the two should be designed together.
Two gates carried over from P5e's lessons: G2 requires integration-spawn's test-name set to
match integration-split's name for name, because a differing set means the lane is quietly
running less; and the arm-proof gate requires every entry to record the child pid and
transport=spawn in its OWN private log - ID-124 established that this kind of false green
really happens, and a spawn lane that actually ran monolith would pass every other gate.
S2's shape must be settled before it is written, and the document says why: E1 is the
cautionary case.
2. The working notes move into the repository (docs/Disaggregated/notes/, 415 .md files)
ROADMAP / CURRENT_STAGE_PROGRESS / MEASUREMENTS cite ruling numbers, audit line numbers and
the provenance of gate figures from ~/w7/notes/, a directory that exists on one machine and
is under no version control. A record cited hundreds of times that lives only locally is not
a record, so it moves in whole, with its directory structure intact.
Only .md moves. Scripts, run logs, census and gate result JSON, patches, APKs and nm dumps
stay where they are: they are evidence DATA rather than documents - large, regenerated per
run, and mostly carrying absolute paths and device serials that mean something only on the
machine that produced them. The mapping and this split are written in
docs/Disaggregated/notes/README.md.
Two exceptions are recorded there too: P6's BRIEF has been promoted to a first-class
document and keeps no copy under notes/, so the two cannot drift apart; and recovered/ holds
material salvaged from failed workflow runs, which may duplicate the like-named phase
directories and is kept because a few of those were the only complete version at the time.
CI's citation lint takes docs/Disaggregated/*.md only (non-recursive), and notes/ is
deliberately outside it: those notes' file:line citations were written against their own
code heads, and resolving them against today's HEAD would fail wholesale - which is not an
error, it is their correct state as a historical record. To check one, use the revision it
declares (--rev).
3. Inconsistencies fixed in passing
- README.md's status line still said P5e was in progress while the stage table already said
closed.
- CURRENT_STAGE_PROGRESS's next-step item 1 still listed the exit gate as pending, though
(a) and (b) were run in the previous commit; rewritten to closed plus the one item that
actually remains (E1).
- ROADMAP's P6 row still had the pre-phase plan in three of its cells; it now carries the
package order, the scope boundary and the two new gates.
Checked with check_doc_citations.py: 125 citations across docs/Disaggregated/*.md, 0 problems.
318 lines
25 KiB
Markdown
318 lines
25 KiB
Markdown
# s1 — round 3 (wave 1.5): the five confirmed findings, ID-47, and the CI ledger red
|
||
|
||
**Branch** `p5/s1`, one commit `949ba509` on top of the integration head `ce53553c` (merged first, per
|
||
ID-44; fast-forward, my round-2 head `4ba14fa4` was already an ancestor). Committer identity checked:
|
||
`Swung0x48 <swung0x48@outlook.com>` (ID-40). Working tree clean after the commit.
|
||
|
||
Everything in the commit is `MOBILEGL_BUILD_DISAGGREGATED`-only (`MG_Remote/*`, `MG_Test/Wire/*`) plus
|
||
one CONTRACT row, and G1 proves it (§7).
|
||
|
||
## 0. The one-line summary per item
|
||
|
||
| # | finding | what changed | red once by |
|
||
|---|---|---|---|
|
||
| 1 | ID-47 / finding 2 | `SEG_REPLY` 16 MiB, 8 × 2 MiB, `MaxReplyBytes` = 2,097,136; `ReplySlotPool::CanHold` + `RequireReadPixelsFits` (client-side named refusal); `ClientSession::ReplyCanHold` / `RequireReadPixelsReplyFits` forwarders; ProtocolSmokeTest pin (now also reads `replyPool` back); CONTRACT §2 row 23 | reverting `ReplyBytes` to 8 MiB → `TheDefaultReplyGeometryHoldsTheLargestP5Read` dies in Post; bare `std::abort()` in `RequireReadPixelsFits` and `<` for `<=` in `CanHold` → `AReadPixelsLargerThanAReplySlotIsRefusedAtTheClientByName` |
|
||
| 2 | finding 5 | the pad-bit case stamps `kRecPad` into the header itself, past `Reserve`'s mask, plus the opposite control (a genuine filler still vanishes and does not advance `appliedSeq`) | deleting `&& header.kind == kRingPadRecordKind` in `Pop` → red on its own message |
|
||
| 3 | finding 6 | `CapsAbiFingerprint()` IS `MixAbiFingerprint(CapsAbiFingerprintInputs())` — one mixer over an inputs struct; CapsCodec's second FNV loop deleted; sensitivity case moved to `SessionHandshakeTest` and started from the production entry point | `return 1;` in `CapsAbiFingerprint` → red; deleting one `mix(...)` line → red naming the input |
|
||
| 4 | finding 7 | null-union Hello driven through `ServerSession::Accept`; null-union Welcome driven through `ClientSession::StartOverTransportPair` (Start's second half, now public); each asserts the guard's own log line | deleting either `msg_as_*() == nullptr` clause → SegFault (red) |
|
||
| 5 | finding 10 | `WireLogFatal` (MGLOG_F + stderr echo + abort) carries every Transport Fatal; both `SessionTestDeath` controls name their diagnostic | bare `std::abort()` in `AdvanceMonotonic` / in `Post` → "died but not with the expected error" |
|
||
| 6 | CI run 35079459114 | the ledger reads `VmHWM`/`VmRSS` in ONE pass and reports its OWN running peak (`SampleRoleMemoryInto`), never the kernel's verbatim | `PeakRssBytes = kernelPeakRssBytes;` → red |
|
||
|
||
All eleven perturbations were executed by `~/w7/p5-s1-redcheck.sh` (log `~/w7/p5-s1-redcheck.log`): every
|
||
one RED for its own reason, every file restored byte-for-byte (sha256-checked), baseline green before
|
||
and after. §8 has the verbatim lines.
|
||
|
||
## 1. ID-47 — the reply geometry (finding 2)
|
||
|
||
**What was wrong.** `ReplyBytes` 8 MiB / 8 slots = 1 MiB slots, `MaxReplyBytes()` = 1,048,560. The
|
||
512×512 RGBA8 read my v1 report claimed the slot covered is 1,048,576 bytes — 16 over. E2's retrace
|
||
snapshot is a full-surface 640×480 GL_RGBA/GL_UNSIGNED_BYTE read = 1,228,800 bytes — 180,240 over.
|
||
|
||
**What changed.**
|
||
- `SessionSegmentSizes::ReplyBytes = 16 MiB` (`SessionRings.h`), `kDefaultReplySlotCount` stays 8 → slots
|
||
of 2 MiB, `MaxReplyBytes() = 2,097,136`. Canonical sizes are now 8/32/16 MiB + 256 KiB; the header
|
||
comment in `SessionRings.h` and the geometry comment in `ReplySlot.h` say so and say why. No knob was
|
||
added (§5 has none for `SEG_REPLY`, by design — ID-47 did not ask for one).
|
||
- `ProtocolSmokeTest.WelcomeCarriesTheFourSegmentAnnouncements` pins 16 MiB **and now reads
|
||
`replyPool()` back** — before this round the pin built the reply SegmentRef and never asserted on it,
|
||
so a moved size would have gone unnoticed there.
|
||
- `SessionTest.TheDefaultGeometryIsTheFourContractRingSizes` pins 16 MiB on the mapping and the
|
||
announcement.
|
||
- CONTRACT §2 row 23 (line 147, c0's file, the one row ID-47 granted): the geometry, the canonical
|
||
sizes, the client-side refusal and its message, and the P6 debt. Nothing else in that file was touched.
|
||
- **The helper.** `ReplySlotPool::CanHold(bytes)` (inclusive boundary, false on an unconfigured pool) and
|
||
`ReplySlotPool::RequireReadPixelsFits(width, height, format, type, bytes)` — returns when the answer
|
||
fits, otherwise `WireLogFatal` with exactly
|
||
`MGPipe: Fatal{ReplyTooLarge, "ReadPixels <w>x<h> 0x<format>/0x<type> <bytes> > <cap>"} - ...`
|
||
and abort. `<format>` is the GL enum pair the record carries (`MGPReadbackInfo::Format/Type`), printed
|
||
as hex, e.g. `ReadPixels 640x480 0x1908/0x1401 1228800 > 2097136`. `ClientSession::ReplyCanHold` and
|
||
`ClientSession::RequireReadPixelsReplyFits` forward verbatim (a fifth primitive beside Encoder /
|
||
Producer / WaitForApplied / ReadReply).
|
||
- `Post`'s oversize refusal is unchanged in meaning and is documented as the LAST line of defence; it
|
||
now goes through `WireLogFatal` so it can be named by a death test (§5).
|
||
|
||
**The one line c1 must add**, in `OnReadPixels`, immediately before `EmitAndWait(MGPWireOp::ReadPixels, ...)`:
|
||
|
||
```cpp
|
||
Client::ClientSession::Active()->RequireReadPixelsReplyFits(info.Box.W, info.Box.H, info.Format, info.Type, info.DstSize);
|
||
```
|
||
|
||
(with whatever names c1's emitter uses for the box extent, the two enums and the byte count it computed
|
||
for `DstSize`; the byte count passed is what would have been posted, so what is refused is exactly that).
|
||
`ReplyCanHold(bytes)` is there for a caller that wants a non-fatal probe first.
|
||
|
||
**Controls (R-16).**
|
||
- `SessionTest.TheDefaultReplyGeometryHoldsTheLargestP5Read` — the verifier's case, committed: a pool from
|
||
`SessionSegmentSizes{}` posts exactly `640*480*4` bytes and reads them back byte-for-byte, then `512*512*4`
|
||
in the next slot; pins `SlotBytes()==2 MiB`, `MaxReplyBytes()==2097136`. **Red once by** reverting
|
||
`ReplyBytes` to 8 MiB: `Subprocess aborted` (Post's oversize branch), the verifier's original outcome.
|
||
- `SessionTestDeath.AReadPixelsLargerThanAReplySlotIsRefusedAtTheClientByName` — the boundary pair on the
|
||
DEFAULT geometry: exactly 2,097,136 bytes (524284×1 RGBA8) returns; 2,097,137 dies with
|
||
`Fatal{ReplyTooLarge, "ReadPixels 524284x1 0x1908/0x1401 2097137 > 2097136"}`; 1024×512 RGBA8 (exactly
|
||
2 MiB, sixteen over — the same sixteen-byte shape that sank the 1 MiB claim) dies with its own dimensions
|
||
in the line; E2's 640×480 read returns. **Red once by** a bare `std::abort()` in
|
||
`RequireReadPixelsFits` (regex matches nothing) and, separately, by `<` for `<=` in `CanHold` (the
|
||
exact-cap call dies).
|
||
- `SessionTestDeath.AReplyLargerThanItsSlotIsFatalRatherThanTruncated` is now a boundary pair at the Post
|
||
level too (exactly `MaxReplyBytes()` posts and reads back; +1 is the named refusal) — see §5.
|
||
|
||
**The fingerprint did not move for ID-47**: it mixes no segment size (§3 lists what it mixes), and the
|
||
Welcome `SegmentRef` cross-check in `Start` is what catches a geometry disagreement.
|
||
|
||
**Not mine, flagged:** `docs/Disaggregated/ARCHITECTURE.md:422` says "`SEG_REPLY` … 8 MiB,4 KiB slot" —
|
||
stale before this round and stale after it; `~/w7/notes/p5/BRIEF-P5.md:742` lists "`SEG_REPLY` 8 MiB". ID-47
|
||
says the BRIEF/ID-file sentences change in the same commit, but `~/w7/notes` is not a git repository and
|
||
those files were not in my grant, so they are the integrator's two lines to fix.
|
||
|
||
## 2. Finding 5 — the pad-bit case never sent the bit
|
||
|
||
`RingProducer::Reserve` masks `kRecPad` out (`flags & ~kRecPad`), so `Reserve(7, kRecPad, 16)` put `flags=0`
|
||
on the wire and the case was green with Pop's kind check deleted. The case now does what a codec with its
|
||
own header struct does: `Reserve(7, kRecNone, 16)`, then stamps `kRecPad` into the eight header bytes
|
||
directly. `ApplyOne` must deliver it (`seen==1`, kind 7, the bit intact, `appliedSeq==1`), and the opposite
|
||
control follows in the same case: a header wearing `kRecPad` whose kind IS `kRingPadRecordKind` is a
|
||
genuine filler, still vanishes, and does NOT advance `appliedSeq` (R-9). That last assertion is what this
|
||
case adds over ID-43's `RingTest.TheTwoFlagSpacesAreDisjointByTranslation`, which is the same control at
|
||
the ring; this one is at the session.
|
||
|
||
**Red once by** deleting `&& header.kind == kRingPadRecordKind` from `RingConsumer::Pop`:
|
||
`SessionTest.ARecordWearingThePadBitIsDeliveredRatherThanEatenAsAFiller ... ***Failed` on its own
|
||
message ("the record was skipped as a wrap filler because it wore bit 2 …"). Chosen over deleting the case
|
||
because the session-level half (appliedSeq counts the record, not the filler) is not stated anywhere else.
|
||
|
||
**§8.2 of s1-v1.md is re-pointed here**: the kind-check control is this case AND
|
||
`RingTest.TheTwoFlagSpacesAreDisjointByTranslation`; the v1 text that named the old case as the control
|
||
was false at the time it was written.
|
||
|
||
## 3. Finding 6 — the fingerprint gate tested a function with no production caller
|
||
|
||
**What changed.** `Transport::AbiFingerprintInputs` (struct, `SessionRings.h`) and
|
||
`MixAbiFingerprint(const AbiFingerprintInputs&)` (`Ring.cpp`) are the ONE mixer.
|
||
`CapsAbiFingerprintInputs()` (new, `CapsCodec.h/.cpp`) fills it from the real values;
|
||
`CapsAbiFingerprint()` is the one-liner `return Transport::MixAbiFingerprint(CapsAbiFingerprintInputs());`.
|
||
The hand-rolled FNV loop in `CapsCodec.cpp` (the second implementation) is deleted.
|
||
|
||
**What the fingerprint mixes after this round** (in order, FNV-1a, never 0):
|
||
`sizeof(DynamicBackendParameters)`, `sizeof(MGPCaps)`, `sizeof(GLFunctionsTable)`,
|
||
`kFormatCapabilityTargetCount`, `kFormatCapabilityFormatCount`, `kFormatCapabilitiesCodecVersion`,
|
||
`kRendererInfoCodecVersion`, `MGPWireOp::kOpCount` (ID-33), `MOBILEGL_ABI_VERSION(major, minor)` (ID-33),
|
||
a presence marker for the stamp, then `GIT_COMMIT_HASH_SHORT`'s bytes (ID-33). ID-33's inputs are all
|
||
kept. Two value-level changes versus the previous `CapsAbiFingerprint`: the stamp is preceded by a
|
||
presence marker (so `nullptr` and `""` are distinct inputs — the old mixer collapsed them), and the
|
||
zero-guard. Nothing pins the value itself; both roles are one build in P5. **It did not move for ID-47**
|
||
(no segment size is mixed).
|
||
|
||
**The case** `SessionHandshakeTest.TheAbiFingerprintChangesWhenAnyOfItsInputsDoes` (moved from
|
||
`SessionTest`, which cannot include `CapsCodec.h` without the umbrella header): (1) `CapsAbiFingerprint()`
|
||
is non-zero, stable, and EQUAL to `MixAbiFingerprint(CapsAbiFingerprintInputs())`; (2) every field of
|
||
`CapsAbiFingerprintInputs()` equals the real sizeof/constant (so a hard-coded input is caught); (3) each of
|
||
the ten inputs, perturbed by one on a copy of the REAL inputs, changes the answer, and `nullptr` ≠ `""` ≠
|
||
a real stamp.
|
||
|
||
**Red once by** (a) `Uint64 CapsAbiFingerprint() { return 1; }` — the verifier's exact perturbation —
|
||
`***Failed` on "CapsAbiFingerprint() is not MixAbiFingerprint over CapsAbiFingerprintInputs()"; (b)
|
||
deleting `mix(inputs.OpCount);` from the mixer — `***Failed` on "MGPWireOp::kOpCount is not mixed".
|
||
`PipeWireCodecTest.TheAbiFingerprintIsStableWithinABuildAndNotZero` (w1's) still passes and is untouched.
|
||
|
||
## 4. Finding 7 — the null-union case never reached either guard
|
||
|
||
**What changed.** New suite `MG_Test/Wire/SessionHandshakeTest.cpp` (own `main()` that points
|
||
`MOBILEGL_LOG_FILE_PATH` at a per-pid file before anything logs — PipeWireCodecTest's shape — because
|
||
`Defines.h` compiles the console sink out and "refusal by message" means reading the log). Registered in
|
||
`Wire/CMakeLists.txt` with PipeWireCodecTest's include paths.
|
||
|
||
- `ANullUnionHelloIsRefusedByAcceptRatherThanDereferenced`: a real `InProcessTransport` pair, the
|
||
null-union Hello sent from the client end, a `ServerSession` of the case's own (the constructor is
|
||
public; not the process singleton) → `Accept` returns `MOBILEGL_ERR_PROTOCOL_MISMATCH`, `Accepted()` is
|
||
false, the log delta contains `MG_Remote server: the first control frame is not a verifiable Hello` and
|
||
no `Fatal{`.
|
||
- `ANullUnionWelcomeIsRefusedByStartRatherThanDereferenced`: `Start()` builds its transport pair itself,
|
||
so no control could queue a frame ahead of the server's Welcome. `ClientSession::StartOverTransportPair(
|
||
clientEnd, serverEnd)` is Start's second half (everything from Hello on), now public and documented as
|
||
such — `Start(mode, endpoint)` = the mode refusal + `CreatePair` + this. The case queues the null-union
|
||
Welcome on the server→client direction, then calls it: Hello goes out, the singleton server's `Accept`
|
||
runs FOR REAL (segments, resolver, its genuine Welcome queued behind the injected one), the client reads
|
||
the injected frame first, refuses with `MG_Remote client: the server's first control frame is not a
|
||
verifiable Welcome`, and `Stop()`'s not-started path closes the server (`Accepted()` false,
|
||
`ServerSession::Active()` null). The case also requires the server's "accepted with NO backend" line in
|
||
the delta, proving `Start` was driven past the point a stub would stop at.
|
||
- The old `SessionTest.AVerifiableFrameCanCarryANullUnionPayload` stays as the reachability premise,
|
||
renamed `ANullUnionFrameVerifiesWhichIsThePremiseOfBothHandshakeGuards`, with a comment saying it is
|
||
the premise and not the control.
|
||
|
||
**Red once by** deleting `envelope->msg_as_Hello() == nullptr` (ServerSession.cpp) →
|
||
`ANullUnionHelloIsRefusedByAcceptRatherThanDereferenced ... ***Exception: SegFault`; deleting
|
||
`envelope->msg_as_Welcome() == nullptr` (ClientSession.cpp) →
|
||
`ANullUnionWelcomeIsRefusedByStartRatherThanDereferenced ... ***Exception: SegFault`. Red by crash rather
|
||
than by message — with the clause gone the very next line dereferences the null member, which is the
|
||
defect the guard exists for; there is no message left to name.
|
||
|
||
**s1-v1.md:338 corrected**: the sentence "so the guard cannot be simplified away" was false when written
|
||
— the case it cited never called either handshake. After this round the two guards are protected by the
|
||
two `SessionHandshakeTest` cases above, which do.
|
||
|
||
## 5. Finding 10 — empty death regexes
|
||
|
||
**Why they were empty, mechanically.** `Defines.h:71-72` builds the logger with `MOBILEGL_LOG_ENABLE_CONSOLE 0`
|
||
and the file sink on, so an MGLOG line never reaches stderr — and a gtest death test matches its regex
|
||
against the child's stderr and nothing else. There was nothing to name.
|
||
|
||
**What changed.** `Transport::WireLogFatal(format, ...)` (`WireLog.h/.cpp`, `[[noreturn]]`, printf-checked):
|
||
formats once, `MGLOG_F`, echoes the line to stderr (flushed; `abort()` does not flush stdio), aborts.
|
||
`AdvanceMonotonic`'s backwards-watermark block and all three of `Post`'s refusals (unconfigured pool,
|
||
seq 0, oversize) go through it, as does `RequireReadPixelsFits`. Texts unchanged. A Fatal now also shows on
|
||
a terminal and in a CI job log, which the file-only sink never did.
|
||
|
||
- `AWatermarkThatMovesBackwardsIsFatalRatherThanIgnored`: regex
|
||
`Fatal\{ProtocolCorruption, "watermark"\} appliedSeq moved backwards, 10 -> 9`.
|
||
- `AReplyLargerThanItsSlotIsFatalRatherThanTruncated`: regex
|
||
`reply pool: Fatal\{ProtocolCorruption\} - a 8177 byte answer for seq 2 does not fit a 8192 byte slot \(payload cap 8176\)`,
|
||
and the case now posts exactly `MaxReplyBytes()` first and reads it back (the boundary pair at the Post
|
||
level).
|
||
|
||
**Red once by** replacing the `WireLogFatal` block in `AdvanceMonotonic` with `(void)name; std::abort();`
|
||
→ `***Failed` ("Death test: … Result: died but not with expected error"); the same in `Post`'s oversize
|
||
branch → `***Failed`. Both are the verifier's perturbations, which previously left both cases green.
|
||
|
||
## 6. GitHub run 35079459114 — `TheMemoryLedgerIsPerRoleAndIsReleasedOnClose` red on CI (add-on)
|
||
|
||
**Diagnosis: CONFIRMED, with the mechanism one step sharper than proposed.** The kernel stores
|
||
`mm->hiwater_rss` only when RSS is about to DROP; `task_mem()` reports `VmHWM = max(stored, rss-at-this-read)`.
|
||
Within ONE read of `/proc/self/status` the pair is therefore self-consistent — but the wave-1 sampler read
|
||
the two keys in TWO passes (one `fopen` per key), and the second `fopen` itself grows RSS (stdio buffer,
|
||
allocator), so the second pass's `VmRSS` can exceed the first pass's `VmHWM`. Probe (`~/w7/p5-s1-probe/`,
|
||
kernel 6.18.33.2-microsoft-standard-WSL2):
|
||
|
||
```
|
||
pass1: VmHWM=3660 VmRSS=3788 | after touching 4 MiB: VmRSS=7884 > pass1 VmHWM? YES | VmHWM re-read=7884
|
||
single-pass reads with 64 KiB growth between them: 0/1000 had VmRSS > VmHWM
|
||
```
|
||
|
||
— two passes disagree by 128 KiB with nothing allocated between them (exactly the CI shape: 4,784,128 <
|
||
4,849,664 is 64 KiB); one pass never disagrees. Why CI and not local: only timing — the second `fopen`'s
|
||
first-touch pages are more often already resident locally; the race is real everywhere.
|
||
|
||
**What changed (as ruled).** `ProcessRssBytes(&peak, ¤t)` reads BOTH keys in one pass (the two old
|
||
accessors remain, implemented over it). `SampleRoleMemoryInto(runningPeak, role, kernelPeak, kernelCurrent)`
|
||
folds `max(kernelPeak, kernelCurrent)` into a caller-owned running peak (CAS loop — the GL and apply
|
||
threads both log memory at phase boundaries) and reports THAT as `PeakRssBytes`, so `Peak >= Current`
|
||
holds by construction and never decreases; `SampleRoleMemory(role)` = one pass + the fold into a
|
||
process-wide running peak. `RoleMemory.h` documents the rule and the run id. The `LogRoleMemory` line is
|
||
unchanged in shape (t1's grep tag `MG_Remote memory[` is untouched).
|
||
|
||
**Controls.** The CI assertion `EXPECT_GE(sample.PeakRssBytes, sample.CurrentRssBytes)` stays, now true by
|
||
construction. New `SessionTest.TheLedgersPeakIsItsOwnRunningMaxAndNeverTheKernelsHighWaterMarkVerbatim`:
|
||
a running peak of its own, fed (peak 100, current 200) → `PeakRssBytes == 200`; then (150, 120) → stays
|
||
200; then (300, 100) → 300 (the kernel's peak still counts when larger); and one real
|
||
`ProcessRssBytes` pass on Linux is non-zero and self-consistent. **Red once by** reverting the fold to
|
||
`sample.PeakRssBytes = kernelPeakRssBytes;` → `***Failed` ("the kernel's peak was reported verbatim
|
||
although its current exceeded it", 100 vs 200) — the CI line, deterministically.
|
||
|
||
## 7. The four self-tests (all on `949ba509`; scripts `~/w7/p5-s1-gate3.sh`, logs `~/w7/p5-s1-gate3-run.log`, `~/w7/p5-s1-split-unit.log`, `~/w7/p5-s1-split-monolith-igpu.log`, `~/w7/p5-s1-igpu-push.log`)
|
||
|
||
1. **G1** against `~/w7/p5-before-libMobileGL.so` (`.READY` = `4595163c…`, the ID-44 re-take): `27814 -> 27814
|
||
defined symbols: 0 added, 0 removed, 0 resized, 0 renamed`, `.text 10806611 -> 10806611 (+0, +0.000%)`;
|
||
`nm` of the pull library finds 0 `MG_Remote` symbols. `check_include_closure.py`: 4 probes, 0 problems.
|
||
`gen_pipe.py --check`: up to date (no `.def` or generator touched).
|
||
2. **`ctest -L unit`**: pull 1814/1814, push 1814/1814, verify 1814/1814; split **1979/1980** with exactly
|
||
the ONE known red that is not mine (`PipeWireCodecTest.NoReplyIsWrittenForARowTheCatalogueGivesNoReplySlot`,
|
||
c1's) — 1980 = the head's 1975 + 5 (six cases added: `TheDefaultReplyGeometryHoldsTheLargestP5Read`,
|
||
`AReadPixelsLargerThanAReplySlotIsRefusedAtTheClientByName`, `TheLedgersPeakIsItsOwnRunningMax…`, and the
|
||
three `SessionHandshakeTest` cases; one moved out of `SessionTest`). Split Wire suites under the task's
|
||
regex (`^Ring|^Doorbell|^Framing|^FdPassing|^InProcessTransport|^Protocol`): 58/58 unchanged; with
|
||
`^Session` added: 91/91 (`SessionTest` 30, `SessionHandshakeTest` 3).
|
||
3. **`integration-gpu`**: push 1128/1128; G14 vs `~/w7/p5-before-ctest-names.txt` (the reference gate's
|
||
`names`/`comm`): 0 removed, 40 added — the head's own P5 entries, none from this round (my cases are
|
||
split-only); G2 pull-vs-push name diff 0. Split under `MOBILEGL_TRANSPORT=monolith`: 1149/1149.
|
||
4. **Generators**: not touched; `--check` green as above.
|
||
|
||
Build-harness hygiene (the verifier's C-10 note): every build ran from a script file, the generator was
|
||
confirmed `Ninja` from `CMakeCache.txt` for all three reconfigured dirs, the split configure was reused, and
|
||
`p5-s1-redcheck.sh` refuses to run a test when the perturbed build's rc is non-zero.
|
||
|
||
## 8. The red-once ledger, verbatim (`~/w7/p5-s1-redcheck.log`)
|
||
|
||
```
|
||
RESULT: RED as required (geometry-8mib) SessionTest.TheDefaultReplyGeometryHoldsTheLargestP5Read ...Subprocess aborted***Exception
|
||
RESULT: RED as required (readpixels-bare-abort) SessionTestDeath.AReadPixelsLargerThanAReplySlotIsRefusedAtTheClientByName ...***Failed
|
||
RESULT: RED as required (canhold-exclusive) SessionTestDeath.AReadPixelsLargerThanAReplySlotIsRefusedAtTheClientByName ...Subprocess aborted***Exception
|
||
RESULT: RED as required (pop-kind-check) SessionTest.ARecordWearingThePadBitIsDeliveredRatherThanEatenAsAFiller ...***Failed
|
||
RESULT: RED as required (fingerprint-return-1) SessionHandshakeTest.TheAbiFingerprintChangesWhenAnyOfItsInputsDoes ...***Failed
|
||
RESULT: RED as required (fingerprint-drop-opcount) SessionHandshakeTest.TheAbiFingerprintChangesWhenAnyOfItsInputsDoes ...***Failed
|
||
RESULT: RED as required (hello-guard) SessionHandshakeTest.ANullUnionHelloIsRefusedByAcceptRatherThanDereferenced ...***Exception: SegFault
|
||
RESULT: RED as required (welcome-guard) SessionHandshakeTest.ANullUnionWelcomeIsRefusedByStartRatherThanDereferenced ...***Exception: SegFault
|
||
RESULT: RED as required (watermark-bare-abort) SessionTestDeath.AWatermarkThatMovesBackwardsIsFatalRatherThanIgnored ...***Failed
|
||
RESULT: RED as required (post-bare-abort) SessionTestDeath.AReplyLargerThanItsSlotIsFatalRatherThanTruncated ...***Failed
|
||
RESULT: RED as required (ledger-kernel-peak) SessionTest.TheLedgersPeakIsItsOwnRunningMaxAndNeverTheKernelsHighWaterMarkVerbatim ...***Failed
|
||
```
|
||
|
||
Each perturbation is an exact-text edit applied and reverted by `~/w7/p5-s1-redcheck.py` (sha256 of the
|
||
file checked equal after revert; no git command runs while the submodule links are on). Baseline green
|
||
before and after: 11/11 named cases pass on the unperturbed tree.
|
||
|
||
## 9. Corrections to s1-v1.md (the verifier's three falsifications)
|
||
|
||
- **:134** "1 MiB, which covers a 512×512 RGBA8 ReadPixels" — false by 16 bytes (the header). True now:
|
||
2 MiB slots, cap 2,097,136, which holds 512×512 RGBA8 (1,048,576) and E2's 640×480 RGBA8 (1,228,800); the
|
||
committed control posts both.
|
||
- **:338** "so the guard cannot be simplified away" — false: the cited case never called a handshake.
|
||
True now: `SessionHandshakeTest`'s two cases drive both guards and go red (SegFault) when either clause
|
||
is deleted.
|
||
- **§8.2** named `ARecordWearingThePadBitIsDeliveredRatherThanEatenAsAFiller` as the kind-check control
|
||
while its producer stripped the bit. True now: that case stamps the bit itself and is red under the
|
||
perturbation, beside ID-43's `RingTest.TheTwoFlagSpacesAreDisjointByTranslation`.
|
||
|
||
## 10. What needs the integrator, and accounts left open
|
||
|
||
1. **Two sentences outside my grant** still say 8 MiB: `docs/Disaggregated/ARCHITECTURE.md:422`
|
||
("8 MiB,4 KiB slot" — wrong on both numbers, before and after) and `~/w7/notes/p5/BRIEF-P5.md:742`.
|
||
ID-47's "same commit" clause cannot cover the notes (not a git repo); both are one-line edits.
|
||
2. **c1's one line** (§1) is the only thing between ID-47's ruling and a server-side abort on an oversize
|
||
read; until `OnReadPixels` lands, `Post`'s refusal is still the only defence. The helper, its message
|
||
and its boundary are pinned on my side, so c1 owes a call, not a test.
|
||
3. **`StartOverTransportPair` is public** for the Welcome control only. If the integrator prefers a
|
||
`friend`-shaped seam, it is a two-line change; I chose the public function because it is Start's real
|
||
second half (Start now composes it) rather than a test-only hook, and its header comment says who may
|
||
call it (nobody but Start and the control).
|
||
4. **The reply-slot count is not announced in Welcome.** Under inproc both roles read the same
|
||
`SessionSegments`; under P6's spawn the client would need `ReplySlotCount` on the wire (or the
|
||
fingerprint) to size its pool. Not a P5 defect — noted so P6 does not rediscover it.
|
||
5. **Wire-suite count** for the gate: the task's regex still gives 58; a gate that wants the new suite
|
||
counted needs `^Session` in it (91 today).
|
||
6. Perf: not measured this round; nothing on a hot path changed (the fold is at phase boundaries, the
|
||
client-side check is one compare per ReadPixels).
|
||
|
||
## 11. Files
|
||
|
||
Committed (`949ba509`): `MG_Remote/Transport/{WireLog.h,WireLog.cpp,ReplySlot.h,SessionRings.h,Ring.cpp,RoleMemory.h,ShmSegment.cpp}`,
|
||
`MG_Remote/{CapsCodec.h,CapsCodec.cpp}`, `MG_Remote/Client/{ClientSession.h,ClientSession.cpp}`,
|
||
`MG_Remote/CONTRACT-P5.md` (row 23 only), `MG_Test/Wire/{SessionTest.cpp,SessionHandshakeTest.cpp (new),ProtocolSmokeTest.cpp,CMakeLists.txt}`.
|
||
Not touched: anything of w1's (`MG_Remote/Wire/*`, `PipeWireCodecTest.cpp`), c1's (`OnReadPixels`,
|
||
`MG_Impl/Pipe/*`), `protocol.fbs`, any `.def` or generator, `ServerSession.cpp` (the guard is exercised, not
|
||
edited). No line of mine meets w1's finding-3 work.
|
||
|
||
Kept under `~/w7/` (cited above): `p5-s1-gate3.sh`, `p5-s1-gate3-run.log`, `p5-s1-redcheck.{py,sh,log}`,
|
||
`p5-s1-redcheck-run.log`, `p5-s1-split-unit.log`, `p5-s1-split-monolith-igpu.log`, `p5-s1-igpu-push.log`,
|
||
`p5-s1-names-{linux,push}.txt`, `p5-s1-symbols.md`, `p5-s1-build-{linux,push,verify,split}.log`,
|
||
`p5-s1-probe/`. Deleted: the configure logs and the interim library-build log.
|