kernel: export sceKernelDeleteTimerEvent (Gran Turismo 7) #2107

Manually merged
github merged 1 commit from gh-pr/2107/head into gh-pr/2107/base 2026-11-26 10:14:32 +00:00
Owner

@⁠NevesHenry on GitHub · 2026-11-04 14:09 UTC · original
NevesHenry:kernel/delete-timer-event → main · +12 −4 · 4 files · 1 commits · merged 2026-11-04 21:57 UTC

Game: Gran Turismo 7 1.000 (PPSA01316), #1930

Problem
sceKernelDeleteTimerEvent (YWQFUyXIVdU) is not exported, while sceKernelAddTimerEvent and sceKernelDeleteHRTimerEvent are. Calls go to the unresolved import stub, which returns 0 and leaves the timer in the queue, so a periodic timer keeps firing after the game deleted it.

Evidence (log attached to #1930)

  • The eboot imports both 57ZK+ODEXWY (AddTimerEvent) and YWQFUyXIVdU (DeleteTimerEvent).
  • The "PGL EventQ" thread follows every EVFILT_TIMER event (ident 1) with a YWQFUyXIVdU stub call: per second the counts are equal until the 1024-call stub log cap (~13 s in).
  • After that the thread keeps getting ~80 timer events per second next to 60 EVFILT_GRAPHICS events, and in 86 places two timer events arrive with no flip in between.

Change
KernelDeleteTimerEvent deletes the EVFILT_TIMER event through KernelDeleteEvent, the way KernelDeleteHRTimerEvent does for EVFILT_HRTIMER (EBADF for a bad queue, ENOENT for an unknown timer), and is registered next to sceKernelAddTimerEvent.

Testing

  • event_queue_lifetime_tests: the periodic timer test now deletes through the export and checks that a deleted zero-interval timer is not delivered again. It passes with the change. With the function reduced to return OK; (what the stub does), it fails at "deleted timer is not delivered again".
  • Linux build (clang 18, Release) of kyty_emulator; clang-format 22.1.3 leaves the change as is.
  • I don't have GT7 1.000, so I can't say yet whether this changes the slow logo or the loading hang. @⁠md-archive, could you try this PR's CI build?

AI use: written with Claude Code (it scanned the issue logs, found the missing export and drafted the change and test). I reviewed the code and checked the NID and the before/after test.

🤖 Generated with Claude Code

**@⁠NevesHenry** on GitHub · 2026-11-04 14:09 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2107) `NevesHenry:kernel/delete-timer-event` → `main` · +12 −4 · 4 files · 1 commits · merged 2026-11-04 21:57 UTC **Game:** Gran Turismo 7 1.000 (PPSA01316), #1930 **Problem** `sceKernelDeleteTimerEvent` (`YWQFUyXIVdU`) is not exported, while `sceKernelAddTimerEvent` and `sceKernelDeleteHRTimerEvent` are. Calls go to the unresolved import stub, which returns 0 and leaves the timer in the queue, so a periodic timer keeps firing after the game deleted it. **Evidence** (log attached to #1930) - The eboot imports both `57ZK+ODEXWY` (AddTimerEvent) and `YWQFUyXIVdU` (DeleteTimerEvent). - The "PGL EventQ" thread follows every EVFILT_TIMER event (ident 1) with a `YWQFUyXIVdU` stub call: per second the counts are equal until the 1024-call stub log cap (~13 s in). - After that the thread keeps getting ~80 timer events per second next to 60 EVFILT_GRAPHICS events, and in 86 places two timer events arrive with no flip in between. **Change** `KernelDeleteTimerEvent` deletes the EVFILT_TIMER event through `KernelDeleteEvent`, the way `KernelDeleteHRTimerEvent` does for EVFILT_HRTIMER (EBADF for a bad queue, ENOENT for an unknown timer), and is registered next to `sceKernelAddTimerEvent`. **Testing** - `event_queue_lifetime_tests`: the periodic timer test now deletes through the export and checks that a deleted zero-interval timer is not delivered again. It passes with the change. With the function reduced to `return OK;` (what the stub does), it fails at "deleted timer is not delivered again". - Linux build (clang 18, Release) of `kyty_emulator`; clang-format 22.1.3 leaves the change as is. - I don't have GT7 1.000, so I can't say yet whether this changes the slow logo or the loading hang. @⁠md-archive, could you try this PR's CI build? **AI use:** written with Claude Code (it scanned the issue logs, found the missing export and drafted the change and test). I reviewed the code and checked the NID and the before/after test. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
sceKernelDeleteTimerEvent (YWQFUyXIVdU) was not registered, although
sceKernelAddTimerEvent and sceKernelDeleteHRTimerEvent are. A call to it
landed in the unresolved import stub, which returns 0 and leaves the
timer in the queue, so a periodic timer the game had deleted kept firing.

Gran Turismo 7 1.000 (PPSA01316, #1930) does this in its "PGL EventQ"
thread: each EVFILT_TIMER event (ident 1) is followed by a
sceKernelDeleteTimerEvent call. The log attached to #1930 reaches the
1024-call stub log cap after about 13 seconds, and the thread keeps
receiving about 80 timer events per second next to 60 graphics events.

Delete the EVFILT_TIMER event with the existing KernelDeleteEvent, the
same way sceKernelDeleteHRTimerEvent deletes EVFILT_HRTIMER events. An
unknown queue gives EBADF and an unknown timer gives ENOENT.

The periodic timer test now deletes its timers through the export and
checks that a deleted zero-interval timer is not delivered again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:14:31 +00:00
github manually merged commit 772f948173 into gh-pr/2107/base 2026-11-26 10:14:32 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-11-04 14:17 UTC · original

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The event queue API adds KernelDeleteTimerEvent and registers it as a libKernel export. The function forwards the queue and ID to KernelDeleteEvent with the timer event filter. Timer lifetime tests use the new function and check that a wait after deletion times out and that deleting the timer again returns KERNEL_ERROR_ENOENT.

Suggested reviewers: nmzik

Change: Bug fix

Merge Risk: Minimal · up to 772f9

The timer deletion API is correctly wired, exported, and covered by lifetime checks.

Pre-merge checks: Passed 4 · Failed 1

Failed 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 with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title names the main change: exporting sceKernelDeleteTimerEvent (the function registered under NID YWQFUyXIVdU in libKernel.cpp and implemented as KernelDeleteTimerEvent in eventQueue.cpp/.h). Th…
Description check Passed The description states the problem (sceKernelDeleteTimerEvent is not exported, so calls hit an unresolved stub), the evidence from the issue log, the change (KernelDeleteTimerEvent forwarding to Kerne…
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.
Full details: Title check

Explanation

The title names the main change: exporting sceKernelDeleteTimerEvent (the function registered under NID YWQFUyXIVdU in libKernel.cpp and implemented as KernelDeleteTimerEvent in eventQueue.cpp/.h). The game reference is context for the motivation. The changeset matches the title, so the check passes.

Full details: Description check

Explanation

The description states the problem (sceKernelDeleteTimerEvent is not exported, so calls hit an unresolved stub), the evidence from the issue log, the change (KernelDeleteTimerEvent forwarding to KernelDeleteEvent and registration beside sceKernelAddTimerEvent), and the testing done. This matches the changeset, so the check passes.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 4 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Tip

🎯 Customize your risk assessments

Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using Merge Risk Instructions and Security Risk Instructions in your review settings. Security architecture risk assessments require the Advanced plan or above.

✅ Automatic approvals, with your rules

Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable Automatic approvals in review settings, with overrides for teams or file paths.

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
Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 91c5820c0c and 772f948173.

Files selected for processing: 4
  • src/kernel/eventQueue.cpp
  • src/kernel/eventQueue.h
  • src/libs/libKernel.cpp
  • tests/EventQueueLifetimeTests.cpp

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

**@⁠coderabbitai[bot]** on GitHub · 2026-11-04 14:17 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2107#issuecomment-6632976041) <!-- coderabbit-ai-generated:v1 --> <!-- 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/2107?scope=ghh_OusAJGA4HG8ljoOV0wJvVx8NmnZIjc2DdjmxOu0xZWA&amp;cs_source=review_comment"><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-buttons-v1/explain-change.svg" alt="Explain Change →" height="32"></picture></a> <!-- review_stack_entry_end --> <!-- recent_review_status_start --> No actionable comments were generated in the recent review. <!-- recent_review_status_end --> <!-- walkthrough_start --> <details> <summary><strong>Walkthrough</strong></summary> <dl> <dd> The event queue API adds `KernelDeleteTimerEvent` and registers it as a libKernel export. The function forwards the queue and ID to `KernelDeleteEvent` with the timer event filter. Timer lifetime tests use the new function and check that a wait after deletion times out and that deleting the timer again returns `KERNEL_ERROR_ENOENT`. **Suggested reviewers:** `nmzik` </dd> </dl> </details> <!-- walkthrough_end --> <!-- change_assessment_start --> <!-- change_assessment_commit:"772f948173f8fcd6e7f3d07a5c3c8b57d05a5413" --> <!-- change_assessment_priority:{"version":1,"urgency":"p2","manual":false} --> **Change:** Bug fix <!-- change_assessment_end --> <details> <summary><strong>Merge Risk:</strong> <strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/risk-unassessed-16.svg" width="16" height="16" align="absmiddle" alt=""></picture> Minimal</strong> · up to <code>772f9</code></summary> <dl> <dd> <!-- final_review_risk_start --> <!-- final_review_risk_label **Merge Risk:** **⚪ Minimal** · up to `772f9` --> <!-- final_review_risk_coverage:{"sourceCommitId":"772f948173f8fcd6e7f3d07a5c3c8b57d05a5413","coveredCommitId":"772f948173f8fcd6e7f3d07a5c3c8b57d05a5413","kind":"reviewed"} --> The timer deletion API is correctly wired, exported, and covered by lifetime checks. <!-- final_review_risk_end --> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_start --> <details> <summary><strong>Pre-merge checks: <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> 4 · <sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> 1</strong></summary> <dl> <dd> <strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-failed-14-v2.svg" width="14" height="14" align="middle" alt="Failed" title="Failed"></picture></sup> Failed checks: 1 warning</strong> | Check name | Status | Explanation | Resolution | | :---------------- | :----------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------- | | Docstring Coverage | ![Warning](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-warning.svg) | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… | Write docstrings for the functions missing them to satisfy the coverage threshold. | <details> <summary><strong><sup><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-counter-passed-14-v2.svg" width="14" height="14" align="middle" alt="Passed" title="Passed"></picture></sup> Passed checks: 4 passed</strong></summary> <dl> <dd> | Check name | Status | Explanation | | :------------------------ | :--------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The title names the main change: exporting sceKernelDeleteTimerEvent (the function registered under NID YWQFUyXIVdU in libKernel.cpp and implemented as KernelDeleteTimerEvent in eventQueue.cpp/.h). Th… | | Description check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | The description states the problem (sceKernelDeleteTimerEvent is not exported, so calls hit an unresolved stub), the evidence from the issue log, the change (KernelDeleteTimerEvent forwarding to Kerne… | | Linked Issues check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ![Passed](https://storage.googleapis.com/coderabbit_public_assets/pre-merge-checks-passed.svg) | Check skipped because no linked issues were found for this pull request. | <details> <summary><strong>Full details: Title check</strong></summary> <dl> <dd> **Explanation** The title names the main change: exporting sceKernelDeleteTimerEvent (the function registered under NID YWQFUyXIVdU in libKernel.cpp and implemented as KernelDeleteTimerEvent in eventQueue.cpp/.h). The game reference is context for the motivation. The changeset matches the title, so the check passes. </dd> </dl> </details> <details> <summary><strong>Full details: Description check</strong></summary> <dl> <dd> **Explanation** The description states the problem (sceKernelDeleteTimerEvent is not exported, so calls hit an unresolved stub), the evidence from the issue log, the change (KernelDeleteTimerEvent forwarding to KernelDeleteEvent and registration beside sceKernelAddTimerEvent), and the testing done. This matches the changeset, so the check passes. </dd> </dl> </details> </dd> </dl> </details> <details> <summary><strong>Full details: Docstring Coverage</strong></summary> <dl> <dd> **Explanation** Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 4 files. **Resolution** Write docstrings for the functions missing them to satisfy the coverage threshold. </dd> </dl> </details> </dd> </dl> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- announcements_start --> > [!TIP] > <details> > <summary><strong>🎯 Customize your risk assessments</strong></summary> > <dl> > <dd> > > Guide how CodeRabbit assesses merge risk and security architecture risk. Highlight sensitive changes and explain your security boundaries using **Merge Risk Instructions** and **Security Risk Instructions** in your review settings. Security architecture risk assessments require the **Advanced plan or above**. > > </dd> > </dl> > </details> > > <details> > <summary><strong>✅ Automatic approvals, with your rules</strong></summary> > <dl> > <dd> > > Let CodeRabbit approve pull requests once required threads are resolved, pre-merge checks pass, and your risk limits are met. Enable **Automatic approvals** in review settings, with overrides for teams or file paths. > > </dd> > </dl> > </details> <!-- announcements_end --> <!-- tips_start --> Thanks for using [CodeRabbit](https://coderabbit.ai?utm_source=oss&utm_medium=github&utm_campaign=KytyPS5/KytyPS5&utm_content=2107)! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. <details> <summary><strong>Share</strong></summary> <dl> <dd> - [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) </dd> </dl> </details> <!-- tips_end --> <!-- recent_review_start --> <h6> <details> <summary><strong><picture><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/info.svg" width="12" height="12" align="absmiddle" alt=""></picture> Recent review info</strong></summary> <dl> <dd> <!-- review_info_content --> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/cog.svg" width="16" height="16" align="absmiddle" alt=""></picture> Run configuration</strong></summary> <dl> <dd> - **Source mode**: Auto - **Repository**: [KytyPS5/KytyPS5](<https://github.com/KytyPS5/KytyPS5>) - **Branch**: [main](<https://github.com/KytyPS5/KytyPS5/tree/main>) - **File**: [.coderabbit.yaml](<https://github.com/KytyPS5/KytyPS5/blob/91c5820c0cecb8ca024d691ca8750be811370591/.coderabbit.yaml>) - **Commit**: [91c5820](<https://github.com/KytyPS5/KytyPS5/commit/91c5820c0cecb8ca024d691ca8750be811370591>) - **Layers**: Repository YAML - **Review profile**: CHILL - **Plan**: Advanced - **Run ID**: `02613d1b-7cd2-4f31-a324-500be3ce3593` </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/git-commit-horizontal.svg" width="16" height="16" align="absmiddle" alt=""></picture> Commits</strong></summary> <dl> <dd> Reviewing files that changed from the base of the PR and between 91c5820c0cecb8ca024d691ca8750be811370591 and 772f948173f8fcd6e7f3d07a5c3c8b57d05a5413. </dd> </dl> </details> <details> <summary><strong><picture><source media="(prefers-color-scheme: dark)" srcset="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner-dark.svg"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-comment-icons-v1/file-plus-corner.svg" width="16" height="16" align="absmiddle" alt=""></picture> Files selected for processing: 4</strong></summary> <dl> <dd> * `src/kernel/eventQueue.cpp` * `src/kernel/eventQueue.h` * `src/libs/libKernel.cpp` * `tests/EventQueueLifetimeTests.cpp` </dd> </dl> </details> **Included review availability:** This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. </dd> </dl> </details> </h6> <!-- recent_review_end -->
Author
Owner

@⁠md-archive on GitHub · 2026-11-04 20:35 UTC · original

Tested 772f948 on GT7 1.000 (PPSA01316), Linux, local build.

Before (dcc_fix- 82d9036d): only 57ZK+ODEXWY (AddTimerEvent) is relocated; YWQFUyXIVdU isn’t.
After: YWQFUyXIVdU now relocates to EventQueue::KernelDeleteTimerEvent.
Slow logo and loading hang are unchanged.

My logging doesn’t record individual EVFILT_TIMER/GRAPHICS events, so I can’t confirm the event rate. Happy to rerun with the setting you need. Both logs attached.

logs_kyty.tar.gz
ppsa01316_82d9036d.tar.gz

**@⁠md-archive** on GitHub · 2026-11-04 20:35 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/2107#issuecomment-6641458832) Tested 772f948 on GT7 1.000 (PPSA01316), Linux, local build. Before (dcc_fix- 82d9036d): only 57ZK+ODEXWY (AddTimerEvent) is relocated; YWQFUyXIVdU isn’t. After: YWQFUyXIVdU now relocates to EventQueue::KernelDeleteTimerEvent. Slow logo and loading hang are unchanged. My logging doesn’t record individual EVFILT_TIMER/GRAPHICS events, so I can’t confirm the event rate. Happy to rerun with the setting you need. Both logs attached. [logs_kyty.tar.gz](https://github.com/user-attachments/files/34392203/logs_kyty.tar.gz) [ppsa01316_82d9036d.tar.gz](https://github.com/user-attachments/files/34392616/ppsa01316_82d9036d.tar.gz)
This discussion has been locked. Commenting is limited to contributors.
No description provided.