Skip to content

[DO NOT MERGE - TEST ONLY] feat(sio2man): priority-ceiling sio2man, misses measurable (#340) - #356

Draft
NathanNeurotic wants to merge 3 commits into
masterfrom
feat/340-sio2man-priority-ceiling
Draft

[DO NOT MERGE - TEST ONLY] feat(sio2man): priority-ceiling sio2man, misses measurable (#340)#356
NathanNeurotic wants to merge 3 commits into
masterfrom
feat/340-sio2man-priority-ceiling

Conversation

@NathanNeurotic

Copy link
Copy Markdown
Owner

TEST BUILD B of 3 — do not merge. If this candidate wins, a clean PR will replace it.

What this tests (Layer 1: the trigger)

ps2sdk PR #709 (Jan 2025) deleted sio2man's dedicated priority-24 worker thread; every SIO2 transaction now runs in the calling client's thread under a semaphore with no priority inheritance. A low-priority holder (mcserv RPC thread = prio 104) preempted by usbd (30/36) mid-transaction stalls freepad's prio-20 vblank pad poll past its window → EE-side padRead misses → #340. ps2sdk PR #898 admits the failure class ("inputs not working and hang on reading") but only swapped padman variants. uOPL's binaries come from a CI container created 2023-09-09 — pre-rewrite, threaded — which is why uOPL stays smooth on the same console while wOPL/official/RiptOPL (all post-rewrite SDKs) do not. src/pad.c is byte-identical between uOPL and official OPL — the app source was never the differentiator.

This branch builds sio2man in-tree from pinned SDK source (modules/sio2man/, upstream style kept verbatim — the whole local patch is ~40 lines, see PROVENANCE.md) with one change: the transaction holder is boosted to priority 24 between acquire and release, restoring the retired worker thread's scheduling guarantee without changing the API — mmceman's hook and post-PR#862 mx4sio keep working, unlike a straight module revert.

Includes the Debug-HUD miss counters but NOT the repeat-pause — so the HUD shows directly whether this module drives the miss rate to ~0.

Tester instructions (zackcage6)

  1. Same navigation torture as PR A (hold-scroll in list + settings, 60+ s).
  2. Debug Colors ON: expected PAD miss: stays at/near 0 even while navigating hard with art loading. Falsified if misses climb like on stock while D-pad still hangs.
  3. MMCE + MX4SIO must still work in this build (the API is unchanged) — a quick check of each is valuable.

Relationship

A = amplifier fix (EE-side, stock sio2man). C = KrahJohlito's 2023-module confirmation build. If C fixes the D-pad and B does too → ship B (+A) clean. If C fixes it and B doesn't → the ceiling theory is wrong; the 2023-vs-new delta gets a deeper look.

🤖 Generated with Claude Code

NathanNeurotic and others added 3 commits August 3, 2026 16:18
…rvation (#340)

ps2sdk PR ps2homebrew#709 (Jan 2025) removed sio2man's dedicated priority-24 worker
thread; a SIO2 transaction now runs every bus phase in the calling
client's thread while holding a plain semaphore with no priority
inheritance. On real hardware a low-priority holder (mcserv's RPC thread
runs at 104) preempted by usbd (30/36) mid-transaction stalls freepad's
priority-20 vblank pad poll past its window, and the EE sees padRead
misses -- the dropped/queued menu input of #340. Old ~2023 builds (the
uOPL-era binaries that stay smooth on the same console) ran all bus
phases on the module's own prio-24 thread, which outranks usbd, so the
window did not exist. ps2sdk PR ps2homebrew#898 acknowledges the failure class
('inputs not working and hang on reading') but only swapped padman
variants; the threadless sio2man was left in place and no pre-rewrite
build of it exists in the SDK anymore.

Build sio2man in-tree from pinned SDK source (f08e889fe, upstream style
kept verbatim for a reviewable diff -- see modules/sio2man/PROVENANCE.md)
with one patch: boost the transaction holder to priority 24 between the
transfer-init WaitSema and the transfer-reset SignalSema, restoring its
previous priority on release. Threads at or above 24 are untouched, a
blocked holder yields the CPU exactly as stock, and the export surface is
unchanged, so mmceman's sio2man hook and the post-PR#862 mx4sio driver
keep working. The embed replaces the SDK's prebuilt freesio2.irx.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tion)

The HUD 'PAD miss:' line has had no writers since the PR #328 revert --
it always rendered miss:0 regardless of hardware behavior. Count ready-
state polls that produce no fresh sample so testers can see whether the
priority-ceiling sio2man actually drives the miss rate to zero. No
behavior change: diagnostics only, repeat handling untouched.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…340)

- Depend the .irx rule on the module's source files instead of the
  directory: a directory mtime does not change on an in-place edit, so
  local incremental builds silently re-embedded a stale module -- fatal
  for the HW A/B experiments this branch exists for.
- Guard the priority restore on the acquiring thread and document that
  the restore-before-SignalSema order is load-bearing: a legacy SDK-1.3
  double-reset (stock-identical exposure) can no longer de-boost the
  next holder or leak a boosted priority.
- Update README/docs/MX4SIO.md wording now that the embedded sio2man is
  built in-tree, and narrow PROVENANCE's game-side claim to MX4SIO
  launches (the only game-core path that loads OPL's sio2man).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 0f2f0d52-a684-4eaa-9277-c98d2dbdf8cd

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant