Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions src/audio/module_adapter/library/userspace_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,14 @@ static int userspace_proxy_invoke(struct userspace_context *user_ctx, uint32_t c
goto done;
}

#ifdef CONFIG_SCHED_CPU_MASK
/* Pin worker thread to the same core as the module */
ret = k_thread_cpu_pin(worker.thread_id, cpu_get_id());
if (ret < 0) {
tr_err(&userspace_proxy_tr, "Failed to pin cpu, error: %d", ret);
goto done;
}
#endif

ret = k_work_user_submit_to_queue(&worker.work_queue, &user_ctx->work_item->work_item);
if (ret < 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/debug/debug_stream/debug_stream_thread_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,12 +367,14 @@ static int thread_info_start(void)
LOG_ERR("k_thread_create() failed for core %u", i);
continue;
}
#ifdef CONFIG_SCHED_CPU_MASK
ret = k_thread_cpu_pin(tid, i);
if (ret < 0) {
LOG_ERR("Pinning thread to code core %u", i);
k_thread_abort(tid);
continue;
}
#endif
snprintf(name, sizeof(name), "%u thread info", i);
ret = k_thread_name_set(tid, name);
if (ret < 0)
Expand Down
2 changes: 2 additions & 0 deletions src/ipc/ipc-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,9 @@ __cold int ipc_init(struct sof *sof)

k_thread_suspend(thread);

#ifdef CONFIG_SCHED_CPU_MASK
k_thread_cpu_pin(thread, PLATFORM_PRIMARY_CORE_ID);
#endif
k_thread_name_set(thread, "ipc_send_wq");

k_thread_resume(thread);
Expand Down
2 changes: 2 additions & 0 deletions src/schedule/zephyr_dma_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -461,8 +461,10 @@ static int zephyr_dma_domain_register(struct ll_schedule_domain *domain,
0,
K_FOREVER);

#ifdef CONFIG_SCHED_CPU_MASK
k_thread_cpu_mask_clear(thread);
k_thread_cpu_mask_enable(thread, core);
#endif
k_thread_name_set(thread, thread_name);

k_thread_start(thread);
Expand Down
4 changes: 4 additions & 0 deletions src/schedule/zephyr_domain.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,10 @@ static int zephyr_domain_register(struct ll_schedule_domain *domain,
zephyr_domain_thread_fn, zephyr_domain, INT_TO_POINTER(core),
NULL, CONFIG_LL_THREAD_PRIORITY, 0, K_FOREVER);

#ifdef CONFIG_SCHED_CPU_MASK
k_thread_cpu_mask_clear(thread);
k_thread_cpu_mask_enable(thread, core);
#endif
k_thread_name_set(thread, thread_name);

k_thread_start(thread);
Expand Down Expand Up @@ -330,8 +332,10 @@ static int zephyr_domain_register_user(struct ll_schedule_domain *domain,
INT_TO_POINTER(core), NULL, CONFIG_LL_THREAD_PRIORITY,
K_USER, K_FOREVER);

#ifdef CONFIG_SCHED_CPU_MASK
k_thread_cpu_mask_clear(thread);
k_thread_cpu_mask_enable(thread, core);
#endif
k_thread_name_set(thread, thread_name);

k_mem_domain_add_thread(zephyr_ll_mem_domain(), thread);
Expand Down
2 changes: 2 additions & 0 deletions src/schedule/zephyr_dp_schedule_application.c
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,14 @@ int scheduler_dp_task_init(struct task **task, const struct sof_uuid_entry *uid,
stack_size, dp_thread_fn, ptask, NULL, NULL,
CONFIG_DP_THREAD_PRIORITY, ptask->flags, K_FOREVER);

#ifdef CONFIG_SCHED_CPU_MASK
/* pin the thread to specific core */
ret = k_thread_cpu_pin(pdata->thread_id, core);
if (ret < 0) {
tr_err(&dp_tr, "zephyr task pin to core failed");
goto e_thread;
}
#endif

k_thread_access_grant(pdata->thread_id, pdata->event, &dp_sync[core]);
scheduler_dp_grant(pdata->thread_id, core);
Expand Down
2 changes: 2 additions & 0 deletions src/schedule/zephyr_dp_schedule_thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,12 +287,14 @@ int scheduler_dp_task_init(struct task **task,
CONFIG_DP_THREAD_PRIORITY, task_memory->task.flags,
K_FOREVER);

#ifdef CONFIG_SCHED_CPU_MASK
/* pin the thread to specific core */
ret = k_thread_cpu_pin(pdata->thread_id, core);
if (ret < 0) {
tr_err(&dp_tr, "zephyr task pin to core failed");
goto e_thread;
}
#endif

#ifdef CONFIG_USERSPACE
if (options & K_USER) {
Expand Down
2 changes: 2 additions & 0 deletions src/schedule/zephyr_twb_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -441,13 +441,15 @@ int scheduler_twb_task_init(struct task **task,
goto err;
}

#ifdef CONFIG_SCHED_CPU_MASK
/* pin the thread to specific core */
ret = k_thread_cpu_pin(thread_id, core);
if (ret < 0) {
ret = -EFAULT;
tr_err(&twb_tr, "zephyr task pin to core %d failed", core);
goto err;
}
#endif

/* set the thread name */
if (name) {
Expand Down
2 changes: 1 addition & 1 deletion west.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ manifest:

- name: zephyr
repo-path: zephyr
revision: 684c9e8f32e4373a21098559f748f06915f950c9
revision: 217a5ac0ca4671ec0cf5c1fd4ea1d222f492fe1e
remote: zephyrproject

# Import some projects listed in zephyr/west.yml@revision
Expand Down
2 changes: 2 additions & 0 deletions zephyr/edf_schedule.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ int scheduler_init_edf(void)
k_thread_suspend(thread);

k_thread_heap_assign(thread, sof_sys_heap_get());
#ifdef CONFIG_SCHED_CPU_MASK
k_thread_cpu_mask_clear(thread);
k_thread_cpu_mask_enable(thread, PLATFORM_PRIMARY_CORE_ID);
#endif
k_thread_name_set(thread, "edf_workq");

k_thread_resume(thread);
Expand Down
Loading