Callbacks: Track callback nesting per thread, one level deep

Replaces the global in-callback counter with each thread's own mipscall
chain, so several threads can be inside callbacks at once, and other
threads' callbacks (better priority ones right away) run while one is.
Verified against pspautotests threads/callbacks/otherthread, recursion
and intrnotify:

- A callback nests only one level: a CB wait that would go deeper never
  returns on hardware, so the callback is left pending instead.
- A non-CB wait inside a callback no longer runs callbacks because of
  the CB wait the callback interrupted.
- Callbacks for a waiting thread are only taken when it beats both the
  running thread and every ready one. After an interrupt (which runs on
  the idle thread) that's the thread about to resume, not idle.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-09-28 15:59:25 -06:00
1 parent 24b41d3f23
commit eda92c4ef2
5 files changed
+64 -50

No files matched your search

+5
View File
@@ -312,15 +312,20 @@ tests_good = [
"threads/callbacks/afterwait",
"threads/callbacks/callbacks",
"threads/callbacks/cancel",
"threads/callbacks/cbtimeout",
"threads/callbacks/check",
"threads/callbacks/count",
"threads/callbacks/create",
"threads/callbacks/delete",
"threads/callbacks/delivery",
"threads/callbacks/exit",
"threads/callbacks/intrnotify",
"threads/callbacks/nested",
"threads/callbacks/notify",
"threads/callbacks/otherthread",
"threads/callbacks/recursion",
"threads/callbacks/refer",
"threads/callbacks/waittypes",
"threads/events/events",
"threads/events/cancel/cancel",
"threads/events/clear/clear",