subset of #10945#10984
Conversation
There was a problem hiding this comment.
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_freesupport behindCONFIG_SOF_BOOT_TEST_STANDALONE || CONFIG_LIBRARYacross 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. |
| * Frees scheduler's resources. | ||
| * @param data Private data of selected scheduler. |
|
@lyakh some build errors. |
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>
| * kernel | ||
| */ | ||
| return type == SOF_SCHEDULE_LL_TIMER; | ||
| return type == SOF_SCHEDULE_LL_TIMER || type == SOF_SCHEDULE_DP; |
There was a problem hiding this comment.
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...?
There was a problem hiding this comment.
@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?
Several commits from #10945 that can be merged now