fix(libScePsml): fail MFSR init and shared-resource limits as a base console does #11140
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/11140"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by akkadbakkad89 on 2026-10-25T19:29:00Z.
What
Makes
scePsmlMfsrInitand the MFSR1 shared-resources path answer as a base (non-Trinity) console does, verified against the real SonylibScePsml.sprxthat ships inside PPSA20397'sfakelibdirectory (Sony build pathW:/Build/J03828141/.../libScePsml.prx— the name is misleading, it is the genuine firmware module).scePsmlMfsrInitreturns0x8A810012before touching the initialized flag whensceKernelIsTrinityMode()is 0 — the same gatescePsmlMfsr2Initalready models — and throwsNotImplementedif Trinity mode is ever reported, instead of fabricating the real init path.GetSharedResourcesInitRequirement/CreateSharedResourcesreturn0x8A81000Dfor disallowed resource types (the binary gates types 1 and 2 behind a console feature flag set during init).CreateSharedResourcesreturns0x8A810015while a shared-resources object already exists (the binary keeps a single-instance refcount).GetMipmapBias'slog2f(dimension / inputWidth) - 1.0fandGetDispatchMfsrPacketSizeInDwords's0x600are confirmed against the same binary.NotImplemented, and on this console they are unreachable by design — the firmware's shared writer behind the 0x158-byte template rotates eight ring slots and emits AGC packets; those routines are not understood, and until then the init gate keeps callers on the correct0x8A810001path.Tested
Windows 11 / MinGW:
guest_psml_testsrewritten for the console contract —scePsmlMfsrInitfails with0x8A810012(twice) and every MFSR1 call keeps returning0x8A810001; the MFSR2 unsupported-console path is unchanged. Passes.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repositoryImported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T19:41:20Z.
Review: CHANGES_REQUESTED
Reviewed exact head
fe38bc485d79315e73d8307e6f340043504b4507. The base-consolescePsmlMfsrInitgate correctly returns before changingg_mfsrInitialized, and the local conventions and diff checks pass. The PR reports the Windowsguest_psml_testsrun; the current upstream product build/test jobs are skipped by repository policy.I found a race in the new single-instance guard in
scePsmlMfsrCreateSharedResources: it checksg_mfsrObjectswhile holdingg_mfsrMutex, releases the lock, then later callsCreateMfsrObject, which reacquires the mutex to insert. Two concurrent calls can both observe no existing shared-resources object and both create one, contrary to the single-instance behavior this change is modeling. Please make the check and insertion atomic (or otherwise establish serialization for this API) and add focused coverage for competing creates where the initialized state can be exercised.The current test change only exercises the base-console path, where init never succeeds, so it cannot catch this race in the new post-init branch. I am requesting changes for that invariant gap.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T20:25:42Z.
Review: APPROVED
Re-reviewed head
44f2c7f607e75eb5127fea325f73dec97b0949b8. The single-instance scan and map insertion now share oneg_mfsrMutexcritical section, closing the TOCTOU window from my earlier review. The added concurrent test covers the reachable uninitialized base-console result and preserves out-handles. I confirmed the PR head has no assignment that can setg_mfsrInitializedtrue:scePsmlMfsrInitreturns unsupported on the modeled console and throws before changing state on Trinity, so the initialized busy branch cannot currently be exercised by a guest test. I therefore do not require an impossible post-init fixture. Local conventions, diff check, and syntax-only compiles ofExport.cppandGuestPsml.cpppass. The Windows focused test is author-reported; product CI jobs are skipped by policy.