Skip to content

fix(kernel): let a pending HRTIMER wake a blocking equeue wait - #1081

Closed
Woesch-Nich wants to merge 1 commit into
boykopovar:mainfrom
Woesch-Nich:pr/equeue-hrtimer-blockwait
Closed

Woesch-Nich wants to merge 1 commit into
boykopovar:mainfrom
Woesch-Nich:pr/equeue-hrtimer-blockwait

Conversation

@Woesch-Nich

Copy link
Copy Markdown

Problem

SceKernelWaitEqueue with micros == 0 (infinite wait) parked forever in m_cond.Wait() even when a one-shot high-resolution timer was pending: the pending expiry was only consulted in the timed branch. A blocking consumer on its timer queue (observed in a real game's dispatcher thread) never woke when its own timer fired.

Fix

Mirror the timed branch: if NextTimerWaitMicros() reports a pending expiry, wait until that deadline instead of blocking indefinitely; fall back to Wait() when no timer is pending (no behavior change in that case).

Testing

Verified in-conversation on a Windows host running the game under the AnyPS5 relinker: the dispatcher thread that previously parked for the whole session now wakes on its HRTIMER expiry; the full thread roster comes up.

Related: #807 (adriadam10) touches the producer side (sceKernelAddTimerEvent/DeleteTimerEvent); this is the consumer-side half.


Attribution: this fix was entirely written by Qwen 3.8 27b (in-conversation coding agent) and supervised by Claude.

SceKernelWaitEqueue with micros == 0 (infinite) parked forever in
m_cond.Wait() even when a one-shot high-resolution timer was pending:
the pending expiry was only consulted in the timed branch. A blocking
consumer (e.g. a game's timer/dispatcher queue) never woke when its
own timer fired.

Mirror the timed branch: if NextTimerWaitMicros() reports a pending
expiry, wait until that deadline instead of blocking indefinitely.

Note: the fix was entirely written by Qwen 3.8 27b (in-conversation
agent) and supervised by Claude.

Related: boykopovar#807 touches sceKernelAddTimerEvent/DeleteTimerEvent; this
change is the consumer-side half of that timer path.
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Closing: main already does this since #807, which makes the infinite wait in Equeue.cpp wake at the pending timer's deadline. If a title still parks there on current main, please comment here with the title ID and the log line where it stops.

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

Labels

libkernel needs rebase Conflicts with main, rebase needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants