Skip to content

userspace: dp: Add option for executing userspace module IPC in DP thread#10579

Open
softwarecki wants to merge 1 commit intothesofproject:mainfrom
softwarecki:userspace-ipc-in-dp
Open

userspace: dp: Add option for executing userspace module IPC in DP thread#10579
softwarecki wants to merge 1 commit intothesofproject:mainfrom
softwarecki:userspace-ipc-in-dp

Conversation

@softwarecki
Copy link
Collaborator

Add the SOF_USERSPACE_MOD_IPC_BY_DP_THREAD Kconfig option and implement support for executing userspace module IPC in its DP thread instead of the shared user worker thread.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Zephyr Kconfig option to route userspace module IPC handling through each module’s DP thread (instead of the shared userspace worker), and wires DP-thread event/work-item plumbing through the DP scheduler and userspace proxy layers.

Changes:

  • Add SOF_USERSPACE_MOD_IPC_BY_DP_THREAD Kconfig option.
  • Extend DP scheduler thread/event handling to wake on IPC events and run the userspace proxy IPC handler in the DP thread.
  • Update userspace proxy to optionally signal/await IPC via the DP thread’s k_event, plus adjust system-agent startup timing for this mode.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
zephyr/Kconfig Adds the new configuration option controlling IPC execution context.
src/schedule/zephyr_dp_schedule_thread.c Handles IPC events in DP thread and registers per-module IPC handler/event linkage.
src/schedule/zephyr_dp_schedule.h Adds per-task storage for the IPC work item pointer.
src/include/sof/audio/module_adapter/library/userspace_proxy.h Extends userspace context with DP-thread event pointer and declares IPC handler registration API.
src/audio/module_adapter/module_adapter.c Adjusts DP task/free sequencing around userspace application teardown.
src/audio/module_adapter/module/generic.c Tweaks DP task cancellation behavior under the new IPC-by-DP-thread mode.
src/audio/module_adapter/library/userspace_proxy.c Implements DP-thread IPC signaling path, IPC handler registration, and defers agent startup in this mode.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@softwarecki are you able to respond to copilot, e.g. some comments may be valid around deref of pointers, best to check and resolve.
Btw, can any of this be tested in a ztest today ?

@softwarecki
Copy link
Collaborator Author

@lgirdwood: I did not think about a ztest yet. I tested it by enabling the config option. I added it in the userspace overlay.

/* Start the system agent, if provided. */
if (start_fn) {
params->ext.agent.params = *agent_params;
params->ext.agent.mod_cfg = *mod_cfg;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about adding?
params->ext.agent.params.mod_cfg = &params->ext.agent.mod_cfg;
OR:
params->ext.agent.params.mod_cfg =NULL;

Copy link
Collaborator Author

@softwarecki softwarecki Feb 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mod_cfg points to a structure allocated on the kernel thread stack, so we must copy the value of the structure here instead of storing a pointer to it.

The line you suggest to add is already present in userspace_proxy_handle_request(). However, you are right that this location is better, so I moved it there.

…read

Add the SOF_USERSPACE_MOD_IPC_BY_DP_THREAD Kconfig option and implement
support for executing userspace module IPC in its DP thread instead of
the shared user worker thread.

Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants