Repository navigation
fix(kernel): restore transitive priority inheritance and green build - #97
Merged
srpatcha merged 2 commits intoSep 1, 2026
Conversation
Commit 02c490a ("restore mutex owner priority after waiter timeout") left the kernel unable to compile and silently dropped transitive priority inheritance: - kernel/src/sync.c referenced m->original_prio (no such field in mtx_t), task_valid(), g_blocked_on, and pi_propagate() - all of which the commit removed, producing 9 compile errors. - kernel/src/task.c gained a duplicate eos_task_set_current_internal definition - a further compile error. - tests/test_kernel.c silently stopped running test_task_stats() and test_tick_overflow(), reporting "10/10" while 12 tests exist. - CHANGELOG.md described a fix that never landed and clobbered the device-tree parser entries. Restore the transitive priority-inheritance machinery from 9a61678 (pi_recompute/pi_propagate over a g_blocked_on chain), remove the duplicate definition, re-register the dropped tests, and repair the changelog. Verified with zig cc (clang): kernel sources compile clean under -Wall -Wextra; test_priority_inherit passes 6/6 and test_kernel passes 12/12.
There was a problem hiding this comment.
🟡 Changes recommended
The new g_blocked_on[] PI state is not reset by eos_kernel_init(), so repeated init (used by tests and possible re-init scenarios) can propagate stale blocking chains and yield incorrect PI behavior.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Restores the kernel’s ability to compile on master and reintroduces transitive mutex priority inheritance (PI) that was regressed by the prior PI rewrite, while also re-enabling missing kernel tests and correcting release notes/task tracking.
Changes:
- Reintroduce transitive PI machinery in
kernel/src/sync.c(blocked-on tracking, recompute + chain propagation) and adjust lock/unlock paths accordingly. - Remove the duplicate
eos_task_set_current_internaldefinition inkernel/src/task.c, keeping the version that sets the RUNNING state. - Re-enable
test_task_stats()andtest_tick_overflow()execution intests/test_kernel.c, and repair related documentation inCHANGELOG.mdandTASKS.md.
File summaries
| File | Description |
|---|---|
| tests/test_kernel.c | Re-adds two previously-defined tests to main() and updates the pass summary count. |
| TASKS.md | Records the work as T-009 with a summary of the build breakage and the restoration steps. |
| kernel/src/task.c | Removes the appended duplicate eos_task_set_current_internal implementation. |
| kernel/src/sync.c | Restores transitive priority inheritance logic and integrates it into mutex lock/unlock/timeout/delete flows. |
| CHANGELOG.md | Updates the mutex PI entry and restores the device-tree parser changelog entries that were clobbered. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+61
to
+63
| /* Mutex each task is blocked on, as handle + 1 so that 0 means "none". */ | ||
| static uint8_t g_blocked_on[EOS_MAX_TASKS]; | ||
|
|
srpatcha
previously approved these changes
Sep 1, 2026
This was referenced Sep 3, 2026
This was referenced Sep 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The kernel does not compile on master. Commit 2c490a ("restore mutex owner priority after waiter timeout", PR #55) rewrote the mutex priority-inheritance logic and left the code in an inconsistent state, so the latest "restore a green build" commit (#71) is not actually green.
This PR restores a compiling kernel and the transitive priority-inheritance behavior that the regression silently removed.
Issue being addressed
kernel/src/sync.c referenced four symbols that the commit had deleted, producing 9 compile errors:
kernel/src/task.c gained a duplicate eos_task_set_current_internal definition (a second one was appended while an existing, more complete one remained), producing a further compile error.
Two secondary regressions from the same commit are also fixed:
Approach and implementation
Testing / validation
The machine this was developed on has no system C toolchain (no cmake/gcc/clang), so verification was done with Zig's bundled clang (zig cc, installed via pip install ziglang):
Full cmake/ctest run: not performed on this machine (no CMake toolchain available).
Type of change
Additional considerations / limitations