Repository navigation
Performance Research C03 Memory Callback Lifetime and Caching
| Field | Value |
|---|---|
| Evidence state | Historical lifetime defect and ordering repair; new cache must account for every reader |
| Inspected source | 322986f4c5502b3fa887a9605ac8cd88e9b2c579 |
| First experiment | Delayed-reader retirement stress before lookup optimization |
| Scope | Addendum dated September 15, 2026; not a current-main benchmark or implementation status |
Unproven performance research · Performance research — common test protocol · Performance research — reproducible checks
Evidence warns against a naive cache. The repository records a previous cached-callback lifetime failure: freeing before asynchronous removal completed caused an access violation. Its repaired ordering begins inside exclusive removal, queues all CPUs' flushes, then a barrier and deferred free. Research history.
Merited design. A cache entry needs both lookup identity and a lifetime guarantee. A generation counter can reject stale identities, but checking one does not by itself keep the pointed-to object alive while it is used. Likewise, an RCU grace period does not automatically invalidate pointers retained in per-CPU caches or generated code outside the intended read-side interval. QEMU RCU.
Expected gain. Avoid repeated callback-range/dispatch lookup in eligible memory accesses. Establish callback lookup frequency and cost before paying for a more elaborate invalidation protocol.
Acceptance. Concurrent install/remove, overlapping ranges, remote CPUs, repeated unregister/re-register with reused addresses, reset, snapshot, and forced delayed readers. A fast single-vCPU run is not a lifetime proof. Never use “RCU” or “atomic” as a substitute for identifying every possible remaining user before free.
Identify readers in generated code, cached per-CPU state and concurrent callback invocations. Use a lifetime protocol, not only an identity counter.
remove publication -> retire every cached/generated reference -> synchronization boundary -> deferred free
Locate the inspected seam before editing; names or ownership may have changed since the pinned review:
git grep -n -E 'mem_access_callback|callback_remove|run_on_cpu|async_run_on_cpu' -- accel include hw/xboxThese are implementation gates to add or exercise, not claims that production tests already exist or passed. Retained standalone checks are on the checks page.
| Test ID | Setup / deliberate control | Required oracle |
|---|---|---|
C03.01 |
Pause a reader after acquiring a callback while another context unregisters it. | The callback remains alive until that reader can no longer use it. |
C03.02 |
Repeated unregister/re-register with allocator address reuse and overlapping ranges. | An old identity cannot invoke a new or freed object; correct callback selection is preserved. |
C03.03 |
Multiple CPU references, reset and snapshot with delayed flush callbacks. | All required references retire before free; sanitizers and state oracle remain clean. |
Collect: callback_lookups, callback_hits, callback_invocations, flush_count, retirement_latency_ns, live_callback_objects, invalid_accesses. Keep exact counts separate from sampled durations; use an uninstrumented build for performance qualification.
Reject or hold: Reject any lifetime gap regardless of lookup speed. A fast single-vCPU retail run is not a concurrent-retirement proof.
Follow the common protocol for source identities, previous-main/fixed-baseline controls, raw results, confidence and retail/XISO qualification. No gain becomes proven from a model, cache hit, local operation count, or shifted wait label alone.
DSP tooling guide and navigation updated November 2, 2026 for experimental PR #384, source 8f51d237. Capture/replay usage and limits.
The earlier wiki-wide review was published November 1, 2026. Emulator source: b7140848. Reviewed wiki content: 1d2b671. Current status · Release availability · Publication process.
- Home
- Current status
- Stable versus main
- Implemented mechanisms
- Controls and defaults
- Measured results and limits
- Complete change register
- System
- CPU and vCPU
- Memory and DMA
- Graphics / NV2A
- APU and audio
- Timing and timers
- Platform and I/O
- Hardware observations
- Fidelity boundaries
- Methodology
- PGR2 routes
- Debugging lag / hot paths
- Tools and commands
- DSP capture, replay and fuzzing
- HLE readiness and public XISO proof
- Concurrent DSP shadow and OpenAL proof
- DSP HLE operation inventory
- DSP HLE fix examples and testing
- Development
- Upstream shortlist
- Wiki maintenance
- Research / retired work
- Optimization catalog
- Hot-path shortcuts
- Researched experiments
- Unproven proposal directory
- PR lessons
- September26 snapshot
Repository · PRs · Issues