Skip to content

Conversation

@tmleman
Copy link
Contributor

@tmleman tmleman commented Jul 23, 2025

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.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @tmleman good to see better alignment with Zephyr logging flows. I think future steps could be using more LOG() API calls.

@tmleman tmleman marked this pull request as ready for review July 23, 2025 15:19
Copilot AI review requested due to automatic review settings July 23, 2025 15:19
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the logging backend management in the IPC4 logging subsystem by migrating from direct backend activation/deactivation to using higher-level logging control functions. The changes align with Zephyr's recommended practices for managing logging backends and provide enhanced control over logging configurations.

  • Replaces log_backend_activate/log_backend_deactivate with log_backend_enable/log_backend_disable
  • Adds log level configuration support through CONFIG_SOF_LOG_LEVEL parameter
  • Updates header includes to use the logging control API

Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments on the why part. Code itself looks good.

#include <rtos/kernel.h>
#if !CONFIG_LIBRARY
#include <zephyr/logging/log_backend.h>
#include <zephyr/logging/log.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tmleman The commit has a certain AI tint to it :) The "why this PR?" was left a bit open still. I guess this is not just refactoring, but starting to use SOF_LOG_LEVEL. Is there any concrete change from this PR? I think we set SOF_LOG_LEVEL for SOF side code already, but does this impact Zephyr side logs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kv2019i I have rephrased the commit description and provided a better justification for these changes.

I guess this is not just refactoring

You're right, it's not just a refactor; it's a fix for an unseen error. And since it's unseen, I didn't mention it ;P

@tmleman tmleman force-pushed the topic/upstream/pr/ipc4/logging/fix_api_use branch from b059584 to da1a9d6 Compare July 24, 2025 12:59
@tmleman tmleman requested review from kv2019i and lgirdwood July 24, 2025 13:04
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>
Copy link
Collaborator

@kv2019i kv2019i left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good now @tmleman !

@lgirdwood lgirdwood merged commit 64f73c7 into thesofproject:main Jul 29, 2025
40 of 45 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants