Skip to content

subset of #10945#10984

Merged
kv2019i merged 8 commits into
thesofproject:mainfrom
lyakh:user-prelim
Jul 13, 2026
Merged

subset of #10945#10984
kv2019i merged 8 commits into
thesofproject:mainfrom
lyakh:user-prelim

Conversation

@lyakh

@lyakh lyakh commented Jul 10, 2026

Copy link
Copy Markdown
Collaborator

Several commits from #10945 that can be merged now

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR cherry-picks a subset of changes from #10945 to unblock parts of the userspace scheduling work (Zephyr LL/DP scheduling and related init/teardown paths), including DP scheduler multicore fixes and conditional scheduler teardown helpers for standalone/library environments.

Changes:

  • Adjust scheduling infrastructure for userspace-managed schedulers (mark DP as userspace-managed; update secondary-core restore check to consider user scheduler lists).
  • Fix DP scheduler locking to use the task’s target core, and harden DP init state for repeated init scenarios.
  • Gate scheduler_free support behind CONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARY across multiple scheduler implementations.

Reviewed changes

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

Show a summary per file
File Description
zephyr/include/sof/lib/memory.h Reorders cold-store debug include block relative to Zephyr-only ll_sch_is_current() declaration.
src/schedule/zephyr_ll.c Adds conditional scheduler_free implementation and wires it into ops only for standalone/library builds.
src/schedule/zephyr_dp_schedule.c Uses task->core for per-core DP locking; initializes ll_tick_src.priv_data.
src/schedule/schedule.c Treats DP scheduler type as “userspace-managed” when userspace LL is enabled.
src/schedule/ll_schedule_xtos.c Conditionally exposes LL scheduler_free in ops for standalone/library builds.
src/platform/library/schedule/ll_schedule.c Conditionally exposes library LL scheduler_free in ops for standalone/library builds.
src/platform/library/schedule/edf_schedule.c Conditionally exposes library EDF scheduler_free in ops for standalone/library builds.
src/init/init.c Restore detection now accepts either kernel schedulers or user schedulers as “already allocated”.
src/include/sof/schedule/schedule.h Conditionally compiles scheduler_free API/inline wrapper for standalone/library builds.
src/include/module/module/interface.h Updates comments on processing-mode hooks.

Comment thread src/schedule/schedule.c
Comment on lines 145 to 146
* Frees scheduler's resources.
* @param data Private data of selected scheduler.
@lgirdwood

Copy link
Copy Markdown
Member

@lyakh some build errors.

lyakh added 8 commits July 13, 2026 09:51
Fix an "unknown type name 'bool'" compilation error.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
set_processing_mode() and get_processing_mode() methods of struct
module_interface aren't unused, they are used by IADK. Fix respective
comments.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
scheduler_is_user() should return true for DP as well.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
schedule_free() is only called from testbench and stand-alone ztest.
Remove it and all scheduler .scheduler_free() methods for all other
builds. Also fix memory leaks in the Zephyr LL version.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When running the LL scheduler in userspace, it can happen that no
kernel-mode schedulers get registered on a running secondary core.
To recognise such cases add a check for userspace schedulers to
check_restore().

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Make ll_sch_is_current() available for builds with
CONFIG_COLD_STORE_EXECUTE_DEBUG unselected.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When LL runs in userspace, multiple DP functions are called in
userspace mode too. They cannot use privileged instructions then.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The LL tick task's .priv_data pointer has to be NULL for the check in
zephyr_ll_task_init() to pass.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

@kv2019i kv2019i left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good, but can you @lyakh check the one comment inline? This feels like wrong in this PR without other changes (to make DP scheduler work in user-space).

Comment thread src/schedule/schedule.c
* kernel
*/
return type == SOF_SCHEDULE_LL_TIMER;
return type == SOF_SCHEDULE_LL_TIMER || type == SOF_SCHEDULE_DP;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hmm, this is a static helper and only used in LL-specific logic, so not sure if this is correct. Arguably this could be clarified, but do you intend to use this later for new logic...?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@kv2019i yes, it's needed for the large set (at least its today's version). We can drop it here now, since the current "main" anyway doesn't work with DP modules if built with userspace LL. And this commit alone doesn't fix that. Would that be preferred?

@kv2019i kv2019i merged commit cf8d4a0 into thesofproject:main Jul 13, 2026
45 checks passed
@lyakh lyakh deleted the user-prelim branch July 13, 2026 11:52
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