Skip to content

Commit c7b7c91

Browse files
committed
ipc: move delayed IPC sending to the primary core
Low level IPC processing should be confined to the primary core. Move delayed IPC sending to a dedicated work queue with core 0 affinity. Fixes: #8165 Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
1 parent 2dbedef commit c7b7c91

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/ipc/ipc-common.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ void ipc_send_queued_msg(void)
170170
k_spin_unlock(&ipc->lock, key);
171171
}
172172

173+
#ifdef __ZEPHYR__
174+
static struct k_work_q ipc_send_wq;
175+
static K_THREAD_STACK_DEFINE(ipc_send_wq_stack, 2048);
176+
#endif
177+
173178
static void schedule_ipc_worker(void)
174179
{
175180
/*
@@ -179,7 +184,7 @@ static void schedule_ipc_worker(void)
179184
#ifdef __ZEPHYR__
180185
struct ipc *ipc = ipc_get();
181186

182-
k_work_schedule(&ipc->z_delayed_work, K_USEC(IPC_PERIOD_USEC));
187+
k_work_reschedule_for_queue(&ipc_send_wq, &ipc->z_delayed_work, K_USEC(IPC_PERIOD_USEC));
183188
#endif
184189
}
185190

@@ -305,6 +310,21 @@ int ipc_init(struct sof *sof)
305310
#endif
306311

307312
#ifdef __ZEPHYR__
313+
struct k_thread *thread = &ipc_send_wq.thread;
314+
315+
k_work_queue_start(&ipc_send_wq,
316+
ipc_send_wq_stack,
317+
K_THREAD_STACK_SIZEOF(ipc_send_wq_stack),
318+
1, NULL);
319+
320+
k_thread_suspend(thread);
321+
322+
k_thread_cpu_mask_clear(thread);
323+
k_thread_cpu_mask_enable(thread, PLATFORM_PRIMARY_CORE_ID);
324+
k_thread_name_set(thread, "ipc_send_wq");
325+
326+
k_thread_resume(thread);
327+
308328
k_work_init_delayable(&sof->ipc->z_delayed_work, ipc_work_handler);
309329
#endif
310330

0 commit comments

Comments
 (0)