handoff: VSync/event-wedge fixes + iterate 2.A–2.BC research notes

Source changes (dormant parity infra, retained from iterate 2.AI/2.AO):
- xenia-kernel/exports.rs: nt_create_event manual_reset polarity +
  related event wiring
- xenia-gpu/mmio_region.rs: D1MODE_VBLANK_VLINE_STATUS hardcode parity

Also lands the audit-runs/ analysis notes (.md/.txt/.json digests) for the
iterate 2.x VSync/0x10e8/0x1004 wedge investigation. Raw trace dumps
(.jsonl/.gz/.csv/.stdout) and agent worktrees (.claude/) are gitignored as
regenerable local artifacts — see memory + HANDOFF for the running findings.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
MechaCat02
2026-06-05 07:19:08 +02:00
parent acd1656753
commit ef93a4fa14
620 changed files with 108303 additions and 1 deletions

View File

@@ -0,0 +1,456 @@
{
"canary-jitter-1.jsonl": {
"path": "xenia-canary/build-cross/bin/Windows/Debug/canary-jitter-1.jsonl",
"tid6_total_seen": 120002,
"waitbegins_by_sid": {
"3b234bbee19d74cf": 33,
"b8e833ada16e15fa": 31,
"a25a16a4f6f547aa": 19,
"2a70efeeed4f4fb6": 13,
"72a4170012353517": 9,
"eec602f5f9aa4bac": 3,
"1938a086284cdbf1": 1,
"cf2f57a69895b36c": 1,
"648cb0d5adfa9125": 1,
"75ae880ec432eb36": 1
},
"rtlenter_calls": 19519,
"rtlleave_calls": 19519,
"window_events": [
{
"idx": 104595,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104596,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104597,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104598,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104599,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104600,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104601,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104602,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104603,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104604,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104605,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104606,
"kind": "wait.begin",
"name": "",
"sid": "75ae880ec432eb36",
"timeout_ns": -1
},
{
"idx": 104607,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104608,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104609,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104610,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104611,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104612,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104613,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104614,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104615,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104616,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104617,
"kind": "import.call",
"name": "NtClose"
},
{
"idx": 104618,
"kind": "kernel.call",
"name": "NtClose"
},
{
"idx": 104619,
"kind": "handle.destroy",
"name": ""
},
{
"idx": 104620,
"kind": "kernel.return",
"name": "NtClose"
}
]
},
"canary-jitter-2.jsonl": {
"path": "xenia-canary/build-cross/bin/Windows/Debug/canary-jitter-2.jsonl",
"tid6_total_seen": 120002,
"waitbegins_by_sid": {
"8ec49cc7eb991db6": 33,
"d896adc3741c77c1": 31,
"a25a16a4f6f547aa": 27,
"2a70efeeed4f4fb6": 14,
"72a4170012353517": 13,
"7b3b3faec1388b19": 2,
"92b9c026e295e0e5": 2,
"1938a086284cdbf1": 1,
"cf2f57a69895b36c": 1,
"648cb0d5adfa9125": 1
},
"rtlenter_calls": 19519,
"rtlleave_calls": 19517,
"window_events": [
{
"idx": 104595,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104596,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104597,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104598,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104599,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104600,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104601,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104602,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104603,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104604,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104605,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104606,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104607,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104608,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104609,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104610,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104611,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104612,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104613,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104614,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104615,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104616,
"kind": "import.call",
"name": "NtClose"
},
{
"idx": 104617,
"kind": "kernel.call",
"name": "NtClose"
},
{
"idx": 104618,
"kind": "handle.destroy",
"name": ""
},
{
"idx": 104619,
"kind": "kernel.return",
"name": "NtClose"
},
{
"idx": 104620,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
}
]
},
"canary-jitter-3.jsonl": {
"path": "xenia-canary/build-cross/bin/Windows/Debug/canary-jitter-3.jsonl",
"tid6_total_seen": 120002,
"waitbegins_by_sid": {
"9eda93a619ebd4ca": 34,
"84fe8d4c3a65f040": 31,
"2a70efeeed4f4fb6": 12,
"a25a16a4f6f547aa": 11,
"72a4170012353517": 9,
"c9f426cc34f55865": 3,
"7b3b3faec1388b19": 2,
"92b9c026e295e0e5": 2,
"1938a086284cdbf1": 1,
"cf2f57a69895b36c": 1
},
"rtlenter_calls": 19519,
"rtlleave_calls": 19519,
"window_events": [
{
"idx": 104595,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104596,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104597,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104598,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104599,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104600,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104601,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104602,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104603,
"kind": "wait.begin",
"name": "",
"sid": "a25a16a4f6f547aa",
"timeout_ns": -1
},
{
"idx": 104604,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104605,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104606,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104607,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104608,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104609,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104610,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104611,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104612,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104613,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104614,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104615,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104616,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104617,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104618,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104619,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104620,
"kind": "import.call",
"name": "NtClose"
}
]
}
}

View File

@@ -0,0 +1,97 @@
#!/usr/bin/env python3
"""Phase C+23 jitter profile probe.
Reads canary jsonls (jitter-1/2/3 + cold-c21 + any fresh runs) and extracts:
- total tid=6 events seen within the first ~120k indices
- the exact event sequence on tid=6 around idx [104,595..104,620]
- count of wait.begin events on tid=6 by SID
- count of contention-prone events (wait.begin, kernel.call RtlEnter / RtlLeave)
Designed to stream line-by-line and not load multi-GB jsonls into RAM.
"""
import json
import os
import sys
from collections import Counter, defaultdict
WINDOW_LO = 104_595
WINDOW_HI = 104_620
TID = 6
TID_EVENT_LIMIT = 120_000
def profile(path: str):
if not os.path.exists(path):
return None
tid6_events = 0
waitbegins = Counter()
importcalls = Counter()
kernelcalls = Counter()
window_events = []
tid_idx = -1
with open(path, "rb") as fh:
for raw in fh:
# Cheap reject before json parse: must contain `"tid":6,`
if b'"tid":6,' not in raw and b'"tid": 6,' not in raw:
continue
try:
ev = json.loads(raw)
except Exception:
continue
if ev.get("tid") != TID:
continue
tid_idx = ev.get("tid_event_idx", tid_idx + 1)
tid6_events += 1
kind = ev.get("kind", "")
if kind == "wait.begin":
sids = ev.get("payload", {}).get("handles_semantic_ids") or []
for s in sids:
waitbegins[s] += 1
elif kind == "import.call":
name = ev.get("payload", {}).get("name", "")
importcalls[name] += 1
elif kind == "kernel.call":
name = ev.get("payload", {}).get("name", "")
kernelcalls[name] += 1
if WINDOW_LO <= tid_idx <= WINDOW_HI:
summary = {
"idx": tid_idx,
"kind": kind,
"name": ev.get("payload", {}).get("name", ""),
}
if kind == "wait.begin":
summary["sid"] = (ev.get("payload", {}).get("handles_semantic_ids") or [None])[0]
summary["timeout_ns"] = ev.get("payload", {}).get("timeout_ns")
window_events.append(summary)
if tid_idx > TID_EVENT_LIMIT:
break
return {
"path": path,
"tid6_total_seen": tid6_events,
"waitbegins_by_sid": dict(waitbegins.most_common(10)),
"rtlenter_calls": importcalls.get("RtlEnterCriticalSection", 0),
"rtlleave_calls": importcalls.get("RtlLeaveCriticalSection", 0),
"window_events": window_events,
}
def main(paths):
out = {}
for p in paths:
print(f"profiling {p}...", file=sys.stderr)
r = profile(p)
if r is None:
print(f" (missing)", file=sys.stderr)
continue
out[os.path.basename(p)] = r
json.dump(out, sys.stdout, indent=2)
print()
if __name__ == "__main__":
main(sys.argv[1:])

View File

@@ -0,0 +1,153 @@
profiling xenia-canary/build-cross/bin/Windows/Debug/canary-cold-c21.jsonl...
{
"canary-cold-c21.jsonl": {
"path": "xenia-canary/build-cross/bin/Windows/Debug/canary-cold-c21.jsonl",
"tid6_total_seen": 120002,
"waitbegins_by_sid": {
"8ec49cc7eb991db6": 33,
"14afe71d37ff58a7": 31,
"a25a16a4f6f547aa": 28,
"2a70efeeed4f4fb6": 12,
"72a4170012353517": 10,
"7b3b3faec1388b19": 4,
"92b9c026e295e0e5": 3,
"df2b7bc3c60f41b9": 2,
"eec602f5f9aa4bac": 2,
"1938a086284cdbf1": 1
},
"rtlenter_calls": 19518,
"rtlleave_calls": 19517,
"window_events": [
{
"idx": 104595,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104596,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104597,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104598,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104599,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104600,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104601,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104602,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104603,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104604,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104605,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104606,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104607,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104608,
"kind": "kernel.call",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104609,
"kind": "kernel.return",
"name": "RtlEnterCriticalSection"
},
{
"idx": 104610,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104611,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104612,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104613,
"kind": "import.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104614,
"kind": "kernel.call",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104615,
"kind": "kernel.return",
"name": "RtlLeaveCriticalSection"
},
{
"idx": 104616,
"kind": "import.call",
"name": "NtClose"
},
{
"idx": 104617,
"kind": "kernel.call",
"name": "NtClose"
},
{
"idx": 104618,
"kind": "handle.destroy",
"name": ""
},
{
"idx": 104619,
"kind": "kernel.return",
"name": "NtClose"
},
{
"idx": 104620,
"kind": "import.call",
"name": "RtlEnterCriticalSection"
}
]
}
}