Skip to content

schedule: ll: moce sys_sem to static memory#11034

Closed
lyakh wants to merge 1 commit into
thesofproject:mainfrom
lyakh:syssem
Closed

schedule: ll: moce sys_sem to static memory#11034
lyakh wants to merge 1 commit into
thesofproject:mainfrom
lyakh:syssem

Conversation

@lyakh

@lyakh lyakh commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

sys_sem objects must be statically allocated in kernel memory.

sys_sem objects must be statically allocated in kernel memory.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Copilot AI review requested due to automatic review settings July 24, 2026 12:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_sem allocation 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 thread src/schedule/zephyr_ll.c
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 thread src/schedule/zephyr_ll.c
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
lyakh marked this pull request as draft July 24, 2026 12:17
@lyakh

lyakh commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator Author

this wasn't right. We need per-task semaphores, not per core.

@lyakh lyakh closed this Jul 24, 2026
@lyakh
lyakh deleted the syssem branch July 24, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants