Skip to content

Commit da1a9d6

Browse files
committed
ipc4: fix logging backend initialization
This patch addresses an issue with the logging backend initialization in the ipc4/logging.c file. The previous implementation used log_backend_activate, which does not fully enable the backend for log collection. This was initially masked by the fact that backends are currently autostarted, but disabling backend autostart would reveal that logs are not being collected as expected. By switching to log_backend_enable, the backend is correctly initialized, ensuring logs are collected reliably. The use of CONFIG_SOF_LOG_LEVEL as a parameter does not impact runtime filtering, as it is not enabled, but it aligns with the current logging configuration practices. This update fixes the logging backend initialization issue, ensuring reliable log collection within the SOF firmware, and prepares the system for scenarios where backend autostart might be disabled, thereby addressing a hidden problem in the logging setup. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
1 parent 632dca3 commit da1a9d6

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/ipc/ipc4/logging.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
#include <ipc4/logging.h>
1717
#include <rtos/kernel.h>
1818
#if !CONFIG_LIBRARY
19-
#include <zephyr/logging/log_backend.h>
2019
#include <zephyr/logging/log.h>
20+
#include <zephyr/logging/log_ctrl.h>
2121
#endif
2222
#if CONFIG_LOG_BACKEND_SOF_PROBE
2323
#include <sof/probe/probe.h>
@@ -144,7 +144,7 @@ int ipc4_logging_enable_logs(bool first_block,
144144
k_mutex_init(&log_mutex);
145145
k_work_init_delayable(&log_work, log_work_handler);
146146

147-
log_backend_activate(log_backend, mtrace_log_hook);
147+
log_backend_enable(log_backend, mtrace_log_hook, CONFIG_SOF_LOG_LEVEL);
148148

149149
mtrace_aging_timer = log_state->aging_timer_period;
150150
if (mtrace_aging_timer < IPC4_MTRACE_AGING_TIMER_MIN_MS) {
@@ -155,7 +155,7 @@ int ipc4_logging_enable_logs(bool first_block,
155155
} else {
156156
k_work_flush_delayable(&log_work, &ipc4_log_work_sync);
157157
adsp_mtrace_log_init(NULL);
158-
log_backend_deactivate(log_backend);
158+
log_backend_disable(log_backend);
159159
}
160160

161161
return 0;
@@ -189,10 +189,10 @@ int ipc4_logging_enable_logs(bool first_block,
189189
if (!probe_is_backend_configured())
190190
return -EINVAL;
191191

192-
log_backend_activate(log_backend, NULL);
192+
log_backend_enable(log_backend, NULL, CONFIG_SOF_LOG_LEVEL);
193193

194194
} else {
195-
log_backend_deactivate(log_backend);
195+
log_backend_disable(log_backend);
196196
}
197197

198198
return 0;

0 commit comments

Comments
 (0)