diff options
Diffstat (limited to 'zephyr/shim/src/tasks.c')
-rw-r--r-- | zephyr/shim/src/tasks.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/zephyr/shim/src/tasks.c b/zephyr/shim/src/tasks.c index a2a4df8320..562a6fe1c9 100644 --- a/zephyr/shim/src/tasks.c +++ b/zephyr/shim/src/tasks.c @@ -293,6 +293,21 @@ BUILD_ASSERT((K_PRIO_PREEMPT(TASK_ID_COUNT - 1) < K_IDLE_PRIO), "CONFIG_NUM_PREEMPT_PRIORITIES too small, some tasks would run at " "idle priority"); +static void check_system_work_queue_priority(void) +{ + k_tid_t thread = &k_sys_work_q.thread; + + /* + * Numerically lower priorities take precedence, so verify the hook + * related threads cannot preempt any of the shimmed tasks. + */ + if (k_thread_priority_get(thread) < (TASK_ID_COUNT - 1)) + cprintf(CC_HOOK, + "ERROR: %s has priority %d but must be >= %d\n", + k_thread_name_get(thread), + k_thread_priority_get(thread), (TASK_ID_COUNT - 1)); +} + void start_ec_tasks(void) { int priority; @@ -355,6 +370,12 @@ void start_ec_tasks(void) /* Create an entry for sysworkq we can send events to */ shimmed_tasks_dyn[TASK_ID_COUNT].zephyr_tid = &k_sys_work_q.thread; + /* + * Now that all threads are created, validate the system workqueue + * priority. + */ + check_system_work_queue_priority(); + tasks_started = 1; } |