Repository navigation
ipc: Safely aborting thread during SOF_IPC4_MOD_INIT_INSTANCE if module crashes - #11485
adityaganeshintel2k wants to merge 8 commits into
Conversation
|
Can one of the admins verify this patch?
|
Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
This enables aborting a userspace thread if an exception occurs from userspace context on intel adsp ace platforms Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
This adds a syscall so that we can call k_thread_cpu_pin from userspace Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
This adds capability of invoking a thread for module initialization and is tied to the same core as the ipc_user thread invoking the module initialization Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
This invokes a thread to complete the module initialization. This is done so that if the module crashes during initialization it can be safely reported back to host without crashing the adsp Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
28a4227 to
48f09a0
Compare
Signed-off-by: adityaganeshintel2k <aditya.ganesh@intel.com>
This setups up the ipc user init thread required for module initialization Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
…erified This adds the capability of aborting a user thread if kernel oops is raised from a syscall verifier Signed-off-by: Ganesh, Aditya <aditya.ganesh@intel.com>
kv2019i
left a comment
There was a problem hiding this comment.
Some comment inline. Need to think more about the approach. Wrapping possible unsafe calls to a worker thread is clearly one option, but I'm concerned about the complexity.
| /** @brief Per-core helper thread objects used for INIT_INSTANCE processing */ | ||
| struct k_thread *init_thread[IPC_DSP_CORE_COUNT]; | ||
| /** @brief Per-core stacks for the INIT_INSTANCE helper threads */ | ||
| k_thread_stack_t *init_stack[IPC_DSP_CORE_COUNT]; |
There was a problem hiding this comment.
I'm a bit worried about the overhead of having additional threads. If we need a monitor thread for each thread, that is sizable memory usage and consumes precious local RAM we have. Ok for testing, but I wonder if we could use some kernel workqueue to monitor threads that should be running, or just have a sinlge watchdog thread.
| thread = ipc_user->init_thread[core]; | ||
| ipc_user->init_result = IPC4_MOD_NOT_INITIALIZED; | ||
|
|
||
| k_thread_create(thread, ipc_user->init_stack[core], |
There was a problem hiding this comment.
Hmm, need to think about this. This does clearly isolate the places where we can handle crashes, but given the IPC code is already complex, wrapping each call with jump to another thread, makes this even more complex.
I wonder should we take another look can we somehow make the IPC kernel-user forwarder function reliably detect if the thread it talks to, has crashed. We use semaphores now? Could we just use a timeout and report an error back that connection was lost fo IPC user thread.
This adds capability of aborting a userspace thread if it crashes during SOF_IPC4_MOD_INIT_INSTANCE and reporting this back to host with a known error status instead of sending a panic notification to host for a dsp reboot