Repository navigation
Conversation
On Zephyr, rtos/panic.h defines assert() as __ASSERT_NO_MSG() and sof_panic() as k_panic(), dropping the SOF panic code. Use the Zephyr macros directly in the code that only Zephyr builds: the kernel side of the userspace proxy, debug stream, telemetry, IDC, init, the library manager, the schedulers and zephyr/. Continuation lines are re-aligned and no lines are added or removed, so __LINE__ in verbose asserts does not change. The shared code also builds on the host, where assert() and sof_panic() report the SOF panic code, so it keeps them until the host has Zephyr assert and panic stubs. No functional change: the generated code is the same. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
This was referenced Dec 1, 2026
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block the migration to native Zephyr assertion and panic APIs.
No open issues 🎉
What changed in this PR
This PR advances #11517’s migration to native Zephyr APIs by replacing SOF assert and panic wrappers in Zephyr-only code. Shared host-built code remains unchanged, with no intended functional change.
Changes:
- Replace
assert()with__ASSERT_NO_MSG()across scheduling, allocation, IPC, and debug code. - Replace
sof_panic()withk_panic()in initialization, scheduler setup, and library management. - Preserve line counts so verbose assertion line numbers remain unchanged.
| File | Description |
|---|---|
zephyr/schedule.c |
Use native assertions for scheduler access checks. |
zephyr/lib/alloc.c |
Use a native assertion for allocation alignment. |
zephyr/include/rtos/task.h |
Use native assertions for task callbacks. |
src/schedule/zephyr_ll.c |
Convert LL locking and core assertions. |
src/schedule/zephyr_dp_schedule_thread.c |
Convert the DP IPC work-item assertion. |
src/kernel/schedule/zephyr_twb_schedule.c |
Convert the TWB core assertion. |
src/kernel/schedule/zephyr_ll-kernel.c |
Convert LL kernel context and lock assertions. |
src/kernel/schedule/zephyr_dp_schedule_thread-kernel.c |
Convert DP core and IPC registration assertions. |
src/kernel/schedule/zephyr_dp_schedule_application-kernel.c |
Convert DP core and privilege assertions. |
src/kernel/schedule/schedule-kernel.c |
Use k_panic() on scheduler allocation failure. |
src/kernel/library_manager/lib_notification.c |
Convert the notification message assertion. |
src/kernel/library_manager/lib_manager.c |
Use k_panic() on context allocation failure. |
src/kernel/init/init.c |
Include the Zephyr kernel header and use k_panic(). |
src/kernel/idc/zephyr_idc.c |
Convert IDC copy-result assertions. |
src/kernel/debug/telemetry/performance_monitor.c |
Convert the performance-slot release assertion. |
src/kernel/debug/debug_stream/debug_stream_slot.c |
Convert debug-stream copy-result assertions. |
src/kernel/audio/module_adapter/library/userspace_proxy.c |
Convert proxy work-item and event assertions. |
Review effort: Balanced
lgirdwood
marked this pull request as ready for review
December 1, 2026 20:16
lgirdwood
requested review from
LaurentiuM1234,
abonislawski,
dabekjakub,
dbaluta,
iuliana-prodan,
kv2019i,
lbetlej,
lyakh,
marcinszkudlinski,
mmaka1,
pblaszko and
plbossart
as code owners
December 1, 2026 20:16
PR 11572: test resultsRun date: 2026-12-01 21:09 UTC Tested commit: 1dec2052ada3a43a6598861afa53eafbae949b4d |
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.
Use the Zephyr assert and panic macros directly in the code that only Zephyr builds. Part of #11517 (step 6, "Asserts and panics").
Changes
On Zephyr,
rtos/panic.hdefinesassert()as__ASSERT_NO_MSG()andsof_panic()ask_panic(), dropping the SOF panic code. The Zephyr-only code now uses the Zephyr macros:zephyr/schedule.c,rtos/task.hand the allocator.Continuation lines are re-aligned and no lines are added or removed, so
__LINE__in verbose asserts does not change.Not in this PR
Shared code: it also builds on the host, where
assert()andsof_panic()report the SOF panic code. It keeps them until the host has Zephyr assert and panic stubs (#11517 step 3).Functional change
None: the generated code is the same.
Testing
🤖 Generated with Claude Code