Skip to content

Commit f86c659

Browse files
committed
schedule: zephyr_ll: user_ll: keep lock while running tasks
In user-space LL builds (CONFIG_SOF_USERSPACE_LL), the IPC user thread cannot block interrupts while making modifications to the audio graph. To workaround this limitation, one could either protect each pipeline object with locks, or keep the LL level lock held while executing LL tasks. This patch implements support for the latter approach. If building SOF for user LL, do not release the lock when running a task. This will help to reduce number of syscalls during a LL iteration, while still allowing to safely implement IPC handlers that need to modify the audio graph. Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
1 parent 21b6b0b commit f86c659

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/schedule/zephyr_ll.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,15 @@ static void zephyr_ll_run(void *data)
231231
list_item_del(list);
232232
list_item_append(list, &task_head);
233233

234+
/* in user-space LL builds, the LL lock protects LL
235+
* tasks against IPC thread, so the lock must be held
236+
* while running the tasks.
237+
* in kernel LL builds, IPC thread blocks interrupts for
238+
* critical section, so lock can be freed here.
239+
*/
240+
#ifndef CONFIG_SOF_USERSPACE_LL
234241
zephyr_ll_unlock(sch, &flags);
242+
#endif
235243

236244
/*
237245
* task's .run() should only return either
@@ -246,7 +254,9 @@ static void zephyr_ll_run(void *data)
246254
state = SOF_TASK_STATE_RESCHEDULE;
247255
}
248256

257+
#ifndef CONFIG_SOF_USERSPACE_LL
249258
zephyr_ll_lock(sch, &flags);
259+
#endif
250260

251261
if (pdata->freeing || state == SOF_TASK_STATE_COMPLETED) {
252262
zephyr_ll_task_done(sch, task);

0 commit comments

Comments
 (0)