Skip to content

app: prj.conf: use trigger threshold of 1 as default#10647

Open
kv2019i wants to merge 1 commit intothesofproject:mainfrom
kv2019i:202603-log-trigger-change
Open

app: prj.conf: use trigger threshold of 1 as default#10647
kv2019i wants to merge 1 commit intothesofproject:mainfrom
kv2019i:202603-log-trigger-change

Conversation

@kv2019i
Copy link
Collaborator

@kv2019i kv2019i commented Mar 23, 2026

Set CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=1 as the default behaviour.

Given most actions in the DSP FW happen every LL (msec) tick, having defer logic of upto 100msec in the logging subsystem is not really helpful. Logging thread should be preempted by higher priority threads in any case.

This setting will cause the logger thread to be woken up (with a semaphore) every time a log entry is printed and no timer is used at all. The actual logging will not happen until logger thread gets to run, but the wakeup request is immediate.

This setting works better with logging backends that have a limited internal buffer (like mtrace and Zephyr winconsole) that are commonly used with SOF targets.

Set CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=1 as the default behaviour.

Given most actions in the DSP FW happen every LL (msec) tick, having
defer logic of upto 100msec in the logging subsystem is not really
helpful. Logging thread should be preempted by higher priority threads
in any case.

This setting will cause the logger thread to be woken up (with a
semaphore) every time a log entry is printed and no timer is used at
all. The actual logging will not happen until logger thread gets to run,
but the wakeup request is immediate.

This setting works better with logging backends that have a limited
internal buffer (like mtrace and Zephyr winconsole) that are commonly
used with SOF targets.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
@kv2019i
Copy link
Collaborator Author

kv2019i commented Mar 23, 2026

FYI @checkupup this might help to avoid dropped messages as well. Got the idea to revisit this setting in our default prj.conf while reviewing your zephyrproject-rtos/zephyr#105550 .

If you have a piece of code (like a module init sequence) emitting a lot of logs, this can easily overwhelm backends like mtrace and winconsole where the backend has a limited buffer and the host may sleep for relative long periods of time (in terms of DSP time) between emptying the buffer. @checkupup additional buffer will help, and this PR should also show a benefit. Neither will help if DSP is continuously sending more logs than the log transport can handle, but for those case, move to DMA based logging (with probes) is the right solution.

Note: keeping as draft to get some CI feedback on this before marking ready for review.

@checkupup
Copy link
Contributor

FYI @checkupup this might help to avoid dropped messages as well. Got the idea to revisit this setting in our default prj.conf while reviewing your zephyrproject-rtos/zephyr#105550 .

If you have a piece of code (like a module init sequence) emitting a lot of logs, this can easily overwhelm backends like mtrace and winconsole where the backend has a limited buffer and the host may sleep for relative long periods of time (in terms of DSP time) between emptying the buffer. @checkupup additional buffer will help, and this PR should also show a benefit. Neither will help if DSP is continuously sending more logs than the log transport can handle, but for those case, move to DMA based logging (with probes) is the right solution.

Thanks, @kv2019i , I have already tried using the following configuration

CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD=1
CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=10

but the issue in the zephyrproject-rtos/zephyr#105550 still persists.

Note: keeping as draft to get some CI feedback on this before marking ready for review.

That's good.

@kv2019i kv2019i marked this pull request as ready for review March 25, 2026 12:56
Copilot AI review requested due to automatic review settings March 25, 2026 12:56
@kv2019i
Copy link
Collaborator Author

kv2019i commented Mar 25, 2026

Initial tests ok, let's mark ready for review to get wider coverage.

And ack @checkupup , this won't solve issue with a burst of log messages that exceed the 4K shared mem buffer. E.g. if you output a lot of debug in module init, this will be all printed before the log thread gets to run (even with this PR) and logs will be lost. So zephyrproject-rtos/zephyr#105550 (or some other solution like DMA/probes logging, dictionary) is still needed for this type of use.

Copy link
Contributor

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

Updates the Zephyr logging configuration to make deferred log processing wake the log thread immediately on each new log message, reducing logging latency for DSP workloads that operate on millisecond tick timing.

Changes:

  • Change CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD from 5 to 1 to wake the log processing thread on every enqueued log entry.
  • Remove the explicit CONFIG_LOG_PROCESS_THREAD_SLEEP_MS=100 timer-based wakeup configuration and update the accompanying comment.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +23 to +24
# Wake the low-priority log thread every time new log
# messages are available
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

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

Minor grammar/style: consider making this a complete sentence (e.g., add a period and/or keep it on one line). Current wording/line break reads a bit awkwardly in the config comment.

Suggested change
# Wake the low-priority log thread every time new log
# messages are available
# Wake the low-priority log thread every time new log messages are available.

Copilot uses AI. Check for mistakes.
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.

3 participants