Skip to content

Commit

Permalink
logging: fix mtrace backend activation on IPC log enable
Browse files Browse the repository at this point in the history
This patch addresses an issue where logs were not being collected after
an IPC message when the mtrace autostart was disabled in regular builds.

The problem was resolved by replacing `log_backend_activate` and
`log_backend_deactivate` with `log_backend_enable` and
`log_backend_disable`, respectively. These functions ensure that the
backend is properly enabled with the initial maximum filtering level and
disabled when necessary. This change ensures that logging behavior
aligns with the intended configuration, allowing logs to be collected as
expected after an IPC message.

Signed-off-by: Tomasz Leman <[email protected]>
  • Loading branch information
tmleman committed Mar 3, 2025
1 parent 2e5088c commit 6843edb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/ipc/ipc4/logging.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include <ipc4/error_status.h>
#include <ipc4/logging.h>
#if !CONFIG_LIBRARY
#include <zephyr/logging/log_backend.h>
#include <zephyr/logging/log.h>
#include <zephyr/logging/log_ctrl.h>
#endif
#if CONFIG_LOG_BACKEND_SOF_PROBE
#include <sof/probe/probe.h>
Expand Down Expand Up @@ -135,8 +135,7 @@ int ipc4_logging_enable_logs(bool first_block,

if (log_state->enable) {
adsp_mtrace_log_init(mtrace_log_hook);

log_backend_activate(log_backend, mtrace_log_hook);
log_backend_enable(log_backend, mtrace_log_hook, CONFIG_SOF_LOG_LEVEL);

mtrace_aging_timer = log_state->aging_timer_period;
if (mtrace_aging_timer < IPC4_MTRACE_AGING_TIMER_MIN_MS) {
Expand All @@ -150,7 +149,7 @@ int ipc4_logging_enable_logs(bool first_block,
schedule_task(&mtrace_task, mtrace_aging_timer * 1000, 0);
} else {
adsp_mtrace_log_init(NULL);
log_backend_deactivate(log_backend);
log_backend_disable(log_backend);
schedule_task_cancel(&mtrace_task);
}

Expand Down

0 comments on commit 6843edb

Please sign in to comment.