libkernel: implement sceKernelAioWaitRequests #1109

Manually merged
github merged 1 commit from gh-pr/1109/head into gh-pr/1109/base 2026-11-26 09:43:17 +00:00
Owner

@⁠NevesHenry on GitHub · 2026-10-06 17:29 UTC · original
NevesHenry:libkernel/aio-wait-requests → main · +81 −28 · 2 files · 1 commits · merged 2026-10-07 00:13 UTC

Summary

sceKernelAioWaitRequests (lgK+oIWkJyA) is not registered. A game that waits for its AIO reads with it gets the unresolved-import stub, which returns 0 without writing states, so the game keeps calling it.

This adds it next to the other AIO calls:

  • it waits on each request with the existing sceKernelAioWaitRequest
  • its argument checks match sceKernelAioPollRequests: EFAULT for null arrays, EINVAL for num outside 1..128, and ESRCH in the slot of an unknown ID
  • submissions complete before they return an ID, so the AND (1) and OR (2) modes give the same states and mode is not otherwise used

Evidence

Both logs show a burst of Read N bytes (pos = ...) from cas_*.cas files (the AIO reads), then the stub call repeated until the log stops:

  • #494 Need for Speed Unbound (PPSA01716, build 2026-09-05-74a78f3): 1025 lines of Unresolved import stub called ... symbol=lgK+oIWkJyA[libkernel_v1][libkernel_v1.1]
  • #79 EA Sports College Football 25 (PPSA04184): the reporter traced the hang to this import, and the log has 1023 of the same lines

NHL 27 (#1101, 2026-10-05 build) also imports it but crashes before calling it. I don't have these games, so I can't say how far they get with this change.

Testing

TestAioBatches in tests/KernelFileSystemTests.cpp now also covers the batch wait:

  • both modes, on completed IDs and on an unknown ID
  • a fresh submission waited on with a timeout
  • invalid arguments, which must leave the outputs untouched

I couldn't run kernel_file_system_tests as is: it creates a Vulkan device first, and the only one I have (lavapipe, Mesa 25.2) lacks VK_KHR_fragment_shader_barycentric. So I ran it in an Ubuntu 24.04 container (clang 18) with local-only edits that are not part of this PR: no window, Memory::InvalidateMemory returns early when no GPU context is installed, and main only calls TestAioBatches. Results:

  • with main's libKernel.cpp, the test aborts at "AIO exports resolve"
  • with this change, all AIO checks pass, including the existing ones

The changed lines are clean under clang-format 22.1.3. Not built on Windows or macOS.

AI assistance

An AI coding assistant (Claude Code) helped me search the issue logs, find the missing export, write the change and the test, and run the builds above. I reviewed the code and the test results. All communication on this PR comes from me.

🤖 Generated with Claude Code

**@⁠NevesHenry** on GitHub · 2026-10-06 17:29 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1109) `NevesHenry:libkernel/aio-wait-requests` → `main` · +81 −28 · 2 files · 1 commits · merged 2026-10-07 00:13 UTC ## Summary `sceKernelAioWaitRequests` (`lgK+oIWkJyA`) is not registered. A game that waits for its AIO reads with it gets the unresolved-import stub, which returns 0 without writing `states`, so the game keeps calling it. This adds it next to the other AIO calls: - it waits on each request with the existing `sceKernelAioWaitRequest` - its argument checks match `sceKernelAioPollRequests`: EFAULT for null arrays, EINVAL for `num` outside 1..128, and ESRCH in the slot of an unknown ID - submissions complete before they return an ID, so the AND (1) and OR (2) modes give the same states and `mode` is not otherwise used ## Evidence Both logs show a burst of `Read N bytes (pos = ...)` from `cas_*.cas` files (the AIO reads), then the stub call repeated until the log stops: - #494 Need for Speed Unbound (PPSA01716, build 2026-09-05-74a78f3): 1025 lines of `Unresolved import stub called ... symbol=lgK+oIWkJyA[libkernel_v1][libkernel_v1.1]` - #79 EA Sports College Football 25 (PPSA04184): the reporter traced the hang to this import, and the log has 1023 of the same lines NHL 27 (#1101, 2026-10-05 build) also imports it but crashes before calling it. I don't have these games, so I can't say how far they get with this change. ## Testing `TestAioBatches` in `tests/KernelFileSystemTests.cpp` now also covers the batch wait: - both modes, on completed IDs and on an unknown ID - a fresh submission waited on with a timeout - invalid arguments, which must leave the outputs untouched I couldn't run `kernel_file_system_tests` as is: it creates a Vulkan device first, and the only one I have (lavapipe, Mesa 25.2) lacks `VK_KHR_fragment_shader_barycentric`. So I ran it in an Ubuntu 24.04 container (clang 18) with local-only edits that are not part of this PR: no window, `Memory::InvalidateMemory` returns early when no GPU context is installed, and `main` only calls `TestAioBatches`. Results: - with main's `libKernel.cpp`, the test aborts at "AIO exports resolve" - with this change, all AIO checks pass, including the existing ones The changed lines are clean under clang-format 22.1.3. Not built on Windows or macOS. ## AI assistance An AI coding assistant (Claude Code) helped me search the issue logs, find the missing export, write the change and the test, and run the builds above. I reviewed the code and the test results. All communication on this PR comes from me. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:43:16 +00:00
github manually merged commit d8e9eadec8 into gh-pr/1109/base 2026-11-26 09:43:17 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-10-06 17:32 UTC · original

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 9770e936-c7e6-4e15-9ef2-e420ddb59435
📥 Commits

Reviewing files that changed from the base of the PR and between fb7ff7ec03 and a46559c4cb2aa2e0ee357ee2987b4b61c26deab4.

📒 Files selected for processing (2)
  • src/libs/libKernel.cpp
  • tests/KernelFileSystemTests.cpp

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds and exports KernelAioWaitRequests. It validates the ID and state pointers and request count, then waits for each request in order. The function returns the first non-OK result, or OK after all waits. Tests cover modes 1 and 2, invalid IDs, invalid inputs, and a timed batch wait.

Suggested reviewers: nmzik

Priority: ➖ Normal

Change: Bug fix

Merge Risk: ⚪ Minimal · up to a4655

No demonstrated batch-wait defect remains. Timeout semantics are unverified, so normal testing remains appropriate before merging.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the libkernel API implementation, which is the main change.
Description check ✅ Passed The description explains the missing export, implementation behavior, supporting evidence, and test coverage. It is directly related to the changeset.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

**@⁠coderabbitai[bot]** on GitHub · 2026-10-06 17:32 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/1109#issuecomment-6021832201) <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/1109?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg?v=2" alt="Review in Change Stack →" width="220" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> - **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `9770e936-c7e6-4e15-9ef2-e420ddb59435` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between fb7ff7ec03e8b7a940b7debdc9f54892a98ab4a5 and a46559c4cb2aa2e0ee357ee2987b4b61c26deab4. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `src/libs/libKernel.cpp` * `tests/KernelFileSystemTests.cpp` </details> **Included review availability:** This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough The change adds and exports `KernelAioWaitRequests`. It validates the ID and state pointers and request count, then waits for each request in order. The function returns the first non-`OK` result, or `OK` after all waits. Tests cover modes 1 and 2, invalid IDs, invalid inputs, and a timed batch wait. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ➖ Normal <!-- change_assessment_commit:"a46559c4cb2aa2e0ee357ee2987b4b61c26deab4" --> **Change:** Bug fix <!-- change_assessment_end --> <!-- final_review_risk_start --> **Merge Risk:** _⚪ Minimal_ · up to `a4655` <!-- final_review_risk_coverage:{"sourceCommitId":"a46559c4cb2aa2e0ee357ee2987b4b61c26deab4","coveredCommitId":"a46559c4cb2aa2e0ee357ee2987b4b61c26deab4","kind":"reviewed"} --> No demonstrated batch-wait defect remains. Timeout semantics are unverified, so normal testing remains appropriate before merging. <!-- final_review_risk_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 4 | ❌ 1</summary> ### ❌ Failed checks (1 warning) | Check name | Status | Explanation | Resolution | | :----------------: | :--------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary>✅ Passed checks (4 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly identifies the libkernel API implementation, which is the main change. | | Description check | ✅ Passed | The description explains the missing export, implementation behavior, supporting evidence, and test coverage. It is directly related to the changeset. | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- autopilot:start --> - [ ] <!-- {"checkboxId":"2708ad07-9f24-4260-9c11-7dc76a49f2e3"} --> <strong title="Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts">Autopilot</strong> · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts <!-- autopilot:end --> <!-- tips_start --> --- Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=1109)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary>❤️ Share</summary> - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code) </details> <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.