Skip to content

Commit f447f3d

Browse files
Jyri Sarhakv2019i
authored andcommitted
pipeline: Use dp_data stack size for DP task
Use IPC module init extended data (dp_data stack_bytes) to set the DP processing thread stack size when available. Fall back to TASK_DP_STACK_SIZE when ext init data is not present or does not provide a stack size. Add Kconfig option ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE (default 2048) to enforce a minimum stack size regardless of what the IPC payload requests. Signed-off-by: Jyri Sarha <jyri.sarha@linux.intel.com>
1 parent f18c87f commit f447f3d

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

src/audio/pipeline/pipeline-schedule.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,7 @@ int pipeline_comp_dp_task_init(struct comp_dev *comp)
590590
{
591591
/* DP tasks are guaranteed to have a module_adapter */
592592
struct processing_module *mod = comp_mod(comp);
593+
size_t stack_size = TASK_DP_STACK_SIZE;
593594
struct task_ops ops = {
594595
.run = dp_task_run,
595596
.get_deadline = NULL,
@@ -605,8 +606,17 @@ int pipeline_comp_dp_task_init(struct comp_dev *comp)
605606
unsigned int flags = IS_ENABLED(CONFIG_USERSPACE) ? K_USER : 0;
606607
#endif
607608

609+
if (mod->priv.cfg.ext_data && mod->priv.cfg.ext_data->dp_data &&
610+
mod->priv.cfg.ext_data->dp_data->stack_bytes > 0) {
611+
stack_size = MAX(mod->priv.cfg.ext_data->dp_data->stack_bytes,
612+
CONFIG_ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE);
613+
comp_info(comp, "stack size set to %zu, %zu requested, min allowed %zu",
614+
stack_size, mod->priv.cfg.ext_data->dp_data->stack_bytes,
615+
CONFIG_ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE);
616+
}
617+
608618
return scheduler_dp_task_init(&comp->task, SOF_UUID(dp_task_uuid), &ops, mod,
609-
comp->ipc_config.core, TASK_DP_STACK_SIZE, flags);
619+
comp->ipc_config.core, stack_size, flags);
610620
}
611621
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
612622

zephyr/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,15 @@ config ZEPHYR_DP_SCHEDULER
258258
DP modules can be located in dieffrent cores than LL pipeline modules, may have
259259
different tick (i.e. 300ms for speech reccognition, etc.)
260260

261+
config ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE
262+
int "Minimum stack size for DP processing thread"
263+
default 512
264+
help
265+
Defines the minimum stack size allowed for DP processing
266+
threads despite what is requested in the module init IPC
267+
ext_init payload. If the stack size requested in the IPC is
268+
smaller than this, then the value defined here takes over.
269+
261270
config CROSS_CORE_STREAM
262271
bool "Enable cross-core connected pipelines"
263272
default y if IPC_MAJOR_4

0 commit comments

Comments
 (0)