From 2ed412a47d95eb030b5f0a8cac818ebeb0b8f355 Mon Sep 17 00:00:00 2001 From: Marcin Szkudlinski Date: Fri, 28 Mar 2025 11:05:15 +0100 Subject: [PATCH] dp: change notifier "LL post run" to "pre run" For DP a deadline time starts at the beginning of LL cycle, so it needs to be calculated there. As DP is the only users of NOTIFIER_ID_LL_POST_RUN I's changed it to NOTIFIER_ID_LL_PRE_RUN instead of introducing another hook Signed-off-by: Marcin Szkudlinski --- src/include/sof/lib/notifier.h | 2 +- src/schedule/ll_schedule.c | 6 +++--- src/schedule/zephyr_dp_schedule.c | 2 +- src/schedule/zephyr_ll.c | 7 +++---- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/include/sof/lib/notifier.h b/src/include/sof/lib/notifier.h index 060906655cb8..9d8ed18f05ca 100644 --- a/src/include/sof/lib/notifier.h +++ b/src/include/sof/lib/notifier.h @@ -31,7 +31,7 @@ enum notify_id { NOTIFIER_ID_BUFFER_CONSUME, /* struct buffer_cb_transact* */ NOTIFIER_ID_BUFFER_FREE, /* struct buffer_cb_free* */ NOTIFIER_ID_DMA_COPY, /* struct dma_cb_data* */ - NOTIFIER_ID_LL_POST_RUN, /* NULL */ + NOTIFIER_ID_LL_PRE_RUN, /* NULL */ NOTIFIER_ID_DMA_IRQ, /* struct dma_chan_data * */ NOTIFIER_ID_DAI_TRIGGER, /* struct dai_group * */ NOTIFIER_ID_MIC_PRIVACY_STATE_CHANGE, /* struct mic_privacy_settings * */ diff --git a/src/schedule/ll_schedule.c b/src/schedule/ll_schedule.c index 7f5d0bca526f..21559afa0ef3 100644 --- a/src/schedule/ll_schedule.c +++ b/src/schedule/ll_schedule.c @@ -313,13 +313,13 @@ static void schedule_ll_tasks_run(void *data) perf_cnt_init(&sch->pcd); + notifier_event(sch, NOTIFIER_ID_LL_PRE_RUN, + NOTIFIER_TARGET_CORE_LOCAL, NULL, 0); + /* run tasks if there are any pending */ if (schedule_ll_is_pending(sch)) schedule_ll_tasks_execute(sch); - notifier_event(sch, NOTIFIER_ID_LL_POST_RUN, - NOTIFIER_TARGET_CORE_LOCAL, NULL, 0); - perf_cnt_stamp(&sch->pcd, perf_ll_sched_trace, 0 /* ignored */); perf_cnt_average(&sch->pcd, perf_avg_ll_sched_trace, 0 /* ignored */); diff --git a/src/schedule/zephyr_dp_schedule.c b/src/schedule/zephyr_dp_schedule.c index 8d976925ec07..1935d37209f0 100644 --- a/src/schedule/zephyr_dp_schedule.c +++ b/src/schedule/zephyr_dp_schedule.c @@ -464,7 +464,7 @@ int scheduler_dp_init(void) if (ret) return ret; - notifier_register(NULL, NULL, NOTIFIER_ID_LL_POST_RUN, scheduler_dp_ll_tick, 0); + notifier_register(NULL, NULL, NOTIFIER_ID_LL_PRE_RUN, scheduler_dp_ll_tick, 0); return 0; } diff --git a/src/schedule/zephyr_ll.c b/src/schedule/zephyr_ll.c index 8ce37c2dfddc..96d8b445f472 100644 --- a/src/schedule/zephyr_ll.c +++ b/src/schedule/zephyr_ll.c @@ -176,6 +176,9 @@ static void zephyr_ll_run(void *data) struct list_item *list, *tmp, task_head = LIST_INIT(task_head); uint32_t flags; + notifier_event(sch, NOTIFIER_ID_LL_PRE_RUN, + NOTIFIER_TARGET_CORE_LOCAL, NULL, 0); + zephyr_ll_lock(sch, &flags); /* @@ -185,7 +188,6 @@ static void zephyr_ll_run(void *data) * always consistent and contains the tasks, that we haven't run in this * cycle yet. */ - for (list = sch->tasks.next; !list_is_empty(&sch->tasks); list = sch->tasks.next) { enum task_state state; struct zephyr_ll_pdata *pdata; @@ -247,9 +249,6 @@ static void zephyr_ll_run(void *data) } zephyr_ll_unlock(sch, &flags); - - notifier_event(sch, NOTIFIER_ID_LL_POST_RUN, - NOTIFIER_TARGET_CORE_LOCAL, NULL, 0); } static void schedule_ll_callback(void *data)