Draft
Conversation
There were some changes to the Zephyr side exception dumpping sopport in the review phase of the PR. This commint aligns to them. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
…struct Replace separate per-CPU arrays (ds_buf[], reports_sent_cpu[], ds_pos[]) with a single struct ds_cpu_state table aligned to CONFIG_DCACHE_LINE_SIZE to avoid false sharing between cores. Also remove the reports_sent reset in the flush path, so that once an exception dump has been sent, the sent-flag stays set and suppresses further output. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
The CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS option limit the number of debug stream slot section to lower number than the actual number of cores. In some situations a high number of cpu sections shrinks the circular buffer size so much that it limit debugging. With this option its possible to use fewer sections. The downside is that the cpus above the number of sections can not send any debug stream messages. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add ds_vamsg(const char *format, va_list ap) to the debug stream text message API and implementation. Refactor ds_msg() to forward to ds_vamsg() so formatting and record emission are handled in one shared path. This enables callers that already operate on va_list to emit debug stream text messages without rebuilding variadic arguments, and keeps the message construction logic centralized. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add optional support to route assert output through debug stream text messages. Introduce Kconfig option SOF_DEBUG_STREAM_TEXT_MSG_ASSERT_PRINT (depends on EXCEPTION_DUMP_HOOK and ASSERT/ASSERT_VERBOSE). Implement assert_print(const char *fmt, ...) to emit via ds_vamsg(), and mirror to vprintk() when CONFIG_EXCEPTION_DUMP_HOOK_ONLY is not set. Avoid duplicate post-fault prints by skipping assert output after an exception report has already been sent on the current CPU. Export assert_print for use by assert paths. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
There is two new options, CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS and CONFIG_SOF_DEBUG_STREAM_TEXT_MSG_ASSERT_PRINT. CONFIG_SOF_DEBUG_STREAM_SLOT_FORCE_MAX_CPUS limits the amount of debug_stream support to a lower number of cores than what is available. As the number of supported cores shrink, the available circular buffer size increases. This means increased bandwidth. This is particularly useful, when debugging a problem on core 0. By defaut this option is commented out. CONFIG_SOF_DEBUG_STREAM_TEXT_MSG_ASSERT_PRINT adds optional support to route assert output through debug stream text messages. This option obeys CONFIG_EXCEPTION_DUMP_HOOK_ONLY. If it is selected the assert print is sent only to debug stream. Without it the assert prints are printed with vprintk too, Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Under Zephyr SOF IDC uses Zephyr's P4WQ for message passing. In it k_p4wq_submit() checks that the new work item isn't already on the queue, and it does that by checking its .thread member. That pointer is set to NULL in p4wq_loop() after calling the work handler with no locks held. So, the work handler could've completed handling an IPC, a response could have been sent and a new IPC could arrive, while p4wq_loop() still hasn't cleared the .thread pointer. To fix this use a mutex in idc_send_msg() to protect the work items. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This is a mostly mechanical split of initial ipc logic into kernel and user files. This is the 1st stage in supporting both privileged kernel and non privileged userspace IPC commands and security surfaces. At a high level library loading and PM will reside as kernel IPC and pipeline and module will become user IPCs. There will be no impact for devices without MMU. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Add a dedicated kernel thread to simulate the future userspace IPC processing path. The thread is gated behind Kconfig option SOF_IPC_USER_THREAD (default y, depends on IPC_MAJOR_4) with a configurable stack size SOF_IPC_USER_THREAD_STACK_SIZE (default 4096). The thread uses a semaphore pair (req_sem / reply_sem) for synchronization and is pinned to the primary core. Currently it only echoes requests back as replies; actual DSP to host IPC message sending from user thread will be handled in subsequent commits. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
Add a synchronous dispatch wrapper for IPC4 global/module user messages and route kernel handler default paths through it. When CONFIG_SOF_IPC_USER_THREAD is enabled, requests are passed to ipc_user thread via req/reply semaphores and protected shared state. When CONFIG_SOF_IPC_USER_THREAD is disabled, the same wrapper functions fall back to direct ipc4_user_process_* calls in the main IPC thread. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
When CONFIG_SOF_IPC_USER_THREAD is enabled, avoid calling k_work_schedule_for_queue() directly from ipc_user thread. Record a per-ipc_user pending scheduling flag instead, and flush that pending request in ipc4_process_in_user_thread() after the request/reply handshake returns to the kernel IPC context. This keeps ipc_send_wq scheduling in kernel IPC thread context while preserving existing behavior for configurations without CONFIG_SOF_IPC_USER_THREAD. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This does not really add any real user space stuff, only another kernel thread to handle IPCs that are supposed to be handled in user-space.