Commit 85238d8
committed
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
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
0 commit comments