Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/schedule/zephyr_dp_schedule_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,

memset(task_memory, 0, sizeof(*task_memory));

const struct comp_driver *drv = mod->dev->drv;

task_memory->drv = *mod->dev->drv;
mod->dev->drv = &task_memory->drv;

Expand Down Expand Up @@ -526,7 +528,6 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,
ptask->ops.get_deadline = ops->get_deadline;
ptask->priv_data = pdata;
list_init(&ptask->list);
*task = ptask;

/* create a zephyr thread for the task */
pdata->thread_id = k_thread_create(pdata->thread, p_stack,
Expand Down Expand Up @@ -627,6 +628,9 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,
k_event_init(pdata->event);
k_thread_start(pdata->thread_id);

/* ptask points into task_memory, so only publish it once it cannot be freed */
*task = ptask;

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.

this looks good although it's a bit difficult to make sure this doesn't break anything by just looking at it. Have you run some DP tests with it to check?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes I have. My usual "aplay -Dhw:0,2 -d 10 wav/sweep_32b2c44kHz.wav & arecord -Dhw:0,2 -f S16_LE -c 2 -r 32000 -d 10 -vvv -i recording.wav" works with this, but let's hope the real CI kicks in and tests this too. This was found when I debugged the llext relocatable stuff, that triggered many error paths.


return 0;

e_dom:
Expand All @@ -643,6 +647,8 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,
e_stack:
user_stack_free(p_stack);
e_tmem:
/* the copy lives in task_memory, so stop pointing at it before freeing */
mod->dev->drv = drv;
mod_free(mod, task_memory);
return ret;
}
Expand Down
Loading