schedule: ll: moce sys_sem to static memory#11034
Closed
lyakh wants to merge 1 commit into
Closed
Conversation
sys_sem objects must be statically allocated in kernel memory. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
lyakh
requested review from
LaurentiuM1234,
dbaluta,
marcinszkudlinski and
pblaszko
as code owners
July 24, 2026 12:08
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Zephyr low-latency (LL) scheduler task lifecycle synchronization to ensure sys_sem objects live in static kernel memory, aligning with Zephyr kernel-object placement requirements.
Changes:
- Introduces a static
struct sys_semallocation and updates per-task scheduler private data to store a semaphore pointer. - Updates task-free/task-done paths to pass semaphore pointers and to log
sys_sem_take()/sys_sem_give()failures. - Initializes the selected semaphore during
zephyr_ll_task_init().
Comment on lines
+41
to
49
| /* sys_sem objects must be statically allocated and in kernel memory */ | ||
| static struct sys_sem ll_sem[CONFIG_CORE_COUNT]; | ||
|
|
||
| /* per-task scheduler data */ | ||
| struct zephyr_ll_pdata { | ||
| bool run; | ||
| bool freeing; | ||
| struct sys_sem sem; | ||
| struct sys_sem *sem; | ||
| }; |
Comment on lines
+514
to
+520
| if (must_wait) { | ||
| /* Wait for up to 100 periods */ | ||
| sys_sem_take(&pdata->sem, K_USEC(LL_TIMER_PERIOD_US * 100)); | ||
| int ret = sys_sem_take(pdata->sem, K_USEC(LL_TIMER_PERIOD_US * 100)); | ||
|
|
||
| if (ret < 0) | ||
| tr_err(&ll_tr, "sys_sem_take() err: %d", ret); | ||
| } |
lyakh
marked this pull request as draft
July 24, 2026 12:17
tmleman
approved these changes
Jul 24, 2026
Collaborator
Author
|
this wasn't right. We need per-task semaphores, not per core. |
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.
sys_sem objects must be statically allocated in kernel memory.