Skip to content

Commit 34a2c67

Browse files
author
Jyri Sarha
committed
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 9f306eb commit 34a2c67

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
@@ -388,6 +388,7 @@ int pipeline_comp_dp_task_init(struct comp_dev *comp)
388388
{
389389
/* DP tasks are guaranteed to have a module_adapter */
390390
struct processing_module *mod = comp_mod(comp);
391+
size_t stack_size = TASK_DP_STACK_SIZE;
391392
struct task_ops ops = {
392393
.run = dp_task_run,
393394
.get_deadline = NULL,
@@ -403,8 +404,17 @@ int pipeline_comp_dp_task_init(struct comp_dev *comp)
403404
unsigned int flags = IS_ENABLED(CONFIG_USERSPACE) ? K_USER : 0;
404405
#endif
405406

407+
if (mod->priv.cfg.ext_data && mod->priv.cfg.ext_data->dp_data &&
408+
mod->priv.cfg.ext_data->dp_data->stack_bytes > 0) {
409+
stack_size = MAX(mod->priv.cfg.ext_data->dp_data->stack_bytes,
410+
CONFIG_ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE);
411+
comp_info(comp, "stack size set to %zu, %zu requested, min allowed %zu",
412+
stack_size, mod->priv.cfg.ext_data->dp_data->stack_bytes,
413+
CONFIG_ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE);
414+
}
415+
406416
return scheduler_dp_task_init(&comp->task, SOF_UUID(dp_task_uuid), &ops, mod,
407-
comp->ipc_config.core, TASK_DP_STACK_SIZE, flags);
417+
comp->ipc_config.core, stack_size, flags);
408418
}
409419
#endif /* CONFIG_ZEPHYR_DP_SCHEDULER */
410420

zephyr/Kconfig

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

206+
config ZEPHYR_DP_SCHEDULER_MIN_STACK_SIZE
207+
int "Minimum stack size for DP processing thread"
208+
default 512
209+
help
210+
Defines the minimum stack size allowed for DP processing
211+
threads despite what is requested in the module init IPC
212+
ext_init payload. If the stack size requested in the IPC is
213+
smaller than this, then the value defined here takes over.
214+
206215
config CROSS_CORE_STREAM
207216
bool "Enable cross-core connected pipelines"
208217
default y if IPC_MAJOR_4

0 commit comments

Comments
 (0)