ipc4: logging: fix use of k_uptime_delta()

Fix incorrect usage of k_uptime_delta() that leads to incorrect
decisions when to send the BUFFER_NOTIFY IPC.

k_uptime_delta() not only calculates the delta, but also stores the
current uptime to the argument passed as reftime. This breaks the logic
in code as mtrace_notify_last_sent was updated unintentionally.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
This commit is contained in:
Kai Vehmanen 2022-09-05 19:12:13 +03:00 committed by Liam Girdwood
parent 0488ffee32
commit fa11388e08
1 changed files with 2 additions and 2 deletions

View File

@ -61,7 +61,7 @@ static void mtrace_log_hook(size_t written, size_t space_left)
{ {
if (arch_proc_id() == MTRACE_IPC_CORE && if (arch_proc_id() == MTRACE_IPC_CORE &&
(space_left < NOTIFY_BUFFER_STATUS_THRESHOLD || (space_left < NOTIFY_BUFFER_STATUS_THRESHOLD ||
k_uptime_delta(&mtrace_notify_last_sent) >= mtrace_aging_timer)) { k_uptime_get() - mtrace_notify_last_sent >= mtrace_aging_timer)) {
ipc_send_buffer_status_notify(); ipc_send_buffer_status_notify();
mtrace_notify_last_sent = k_uptime_get(); mtrace_notify_last_sent = k_uptime_get();
mtrace_bytes_pending = 0; mtrace_bytes_pending = 0;
@ -79,7 +79,7 @@ static void mtrace_log_hook(size_t written, size_t space_left)
static enum task_state mtrace_task_run(void *data) static enum task_state mtrace_task_run(void *data)
{ {
if (k_uptime_delta(&mtrace_notify_last_sent) >= mtrace_aging_timer && if (k_uptime_get() - mtrace_notify_last_sent >= mtrace_aging_timer &&
mtrace_bytes_pending) mtrace_bytes_pending)
mtrace_log_hook(0, 0); mtrace_log_hook(0, 0);