Skip to content

Commit 85238d8

Browse files
ptl: userspace: handle userspace module IPC in the DP thread
The current k_work_user_q-based worker used for userspace IPC processing does not work in the multicore case. An assert is triggered in k_thread_cpu_pin() when a userspace module is created on a secondary core. k_thread_cpu_pin() only works for a thread that is not currently running. Unfortunately, k_work_user_queue_start() not only initializes the queue but also immediately starts its worker thread on core 0. By the time k_thread_cpu_pin() is called, the worker thread may still be running (in our test it always is) and has not yet reached the wait condition in its loop where it goes to sleep. Wrapping the k_thread_cpu_pin() call in k_thread_suspend() and k_thread_resume() does not help either: this time the firmware hangs (sometimes, depending on the log level) in k_thread_suspend() due to a race. If the worker thread reaches its wait condition just before the IPI (triggered by k_thread_suspend()) is processed, k_thread_suspend() waits forever for the thread to become suspended. A possible fix would be to create a work queue per core and pin their threads from core 0, e.g. from secondary_core_init(). Or, more simply, switch to the implementation that uses the DP thread, as is done here. Signed-off-by: Serhiy Katsyuba <serhiy.katsyuba@intel.com>
1 parent 17c5a3b commit 85238d8

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

app/boards/intel_adsp_ace30_ptl.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ CONFIG_DYNAMIC_THREAD=y
7474
CONFIG_DYNAMIC_THREAD_ALLOC=y
7575
CONFIG_DYNAMIC_THREAD_PREFER_ALLOC=y
7676
CONFIG_SOF_STACK_SIZE=8192
77+
CONFIG_SOF_USERSPACE_MOD_IPC_BY_DP_THREAD=y
7778
CONFIG_SOF_USERSPACE_PROXY=y
7879
CONFIG_MAX_THREAD_BYTES=3
7980

0 commit comments

Comments
 (0)