Skip to content

Commit 6843edb

Browse files
committed
logging: fix mtrace backend activation on IPC log enable
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 <tomasz.m.leman@intel.com>
1 parent 2e5088c commit 6843edb

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/ipc/ipc4/logging.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
#include <ipc4/error_status.h>
1616
#include <ipc4/logging.h>
1717
#if !CONFIG_LIBRARY
18-
#include <zephyr/logging/log_backend.h>
1918
#include <zephyr/logging/log.h>
19+
#include <zephyr/logging/log_ctrl.h>
2020
#endif
2121
#if CONFIG_LOG_BACKEND_SOF_PROBE
2222
#include <sof/probe/probe.h>
@@ -135,8 +135,7 @@ int ipc4_logging_enable_logs(bool first_block,
135135

136136
if (log_state->enable) {
137137
adsp_mtrace_log_init(mtrace_log_hook);
138-
139-
log_backend_activate(log_backend, mtrace_log_hook);
138+
log_backend_enable(log_backend, mtrace_log_hook, CONFIG_SOF_LOG_LEVEL);
140139

141140
mtrace_aging_timer = log_state->aging_timer_period;
142141
if (mtrace_aging_timer < IPC4_MTRACE_AGING_TIMER_MIN_MS) {
@@ -150,7 +149,7 @@ int ipc4_logging_enable_logs(bool first_block,
150149
schedule_task(&mtrace_task, mtrace_aging_timer * 1000, 0);
151150
} else {
152151
adsp_mtrace_log_init(NULL);
153-
log_backend_deactivate(log_backend);
152+
log_backend_disable(log_backend);
154153
schedule_task_cancel(&mtrace_task);
155154
}
156155

0 commit comments

Comments
 (0)