-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] Ability to start DMA-trace while DSP is running #3275
Comments
If sof-logger is started (or restarted) while DSP is running, the initial traces may be incomplete. Document the limitation and give a brief explanation of the current ringbuffer design and how it affects the start-up behaviour. BugLink: thesofproject/sof-test#297 BugLink: thesofproject/linux#3275 Signed-off-by: Kai Vehmanen <[email protected]>
If sof-logger is started (or restarted) while DSP is running, the initial traces may be incomplete. Document the limitation and give a brief explanation of the current ringbuffer design and how it affects the start-up behaviour. BugLink: thesofproject/sof-test#297 BugLink: thesofproject/linux#3275 Signed-off-by: Kai Vehmanen <[email protected]>
In practice this race is a problem only when the FW logs are so verbose that they fill the entire ring buffer. It's never been a problem for me.
Which current problem does this solve?
Yes but not urgent, |
@marc-hb wrote:
Let's discuss that. It seems based on discussion on #3136 that currently sof-test cases are assuming some data is always in the trace buffer. This was tracked also in thesofproject/sof-test#297 If we'd move to a "double ringbuffer" in the SOF driver, "sof-logger -t" would always return at least some traces and this would be guaranteed if the firmware boot was successful. IOW, if no traces are read, this is a guaranteed sign of failure and can be This mostly impacts cases where DSP is runtime suspended and resumed during (or between) test cases, and the test cases are restarting sof-logger. With current semantics, if the DSP has suspended/resumed with sof-logger not running continuously, some traces are missed, and it is possible trace log is empty when sof-logger is started. I don't fully understand the problems involved, but I can see with a double-buffer kernel trace, test case development would be easier. One non-kernel solution is to improve sof-logger with the ability to keep it running even when driver is not loaded. It could keep polling the availability of kernel trace node and start emitting trace whenever the trace node becomes available. This would allow to get the complete FW trace for a full test plan, including driver load/unload cases. Currently sof-logger must be restarted as the driver must be loaded, but this can be changed. |
Yes, and for various good and bad reasons this kept passing until #3136.
From a validation perspective the most important thing is as you wrote: determinism. You obviously can't assert something non-deterministic. So in any simple situation the logs should be either always empty or always present. Determinism is made more complicated by power management that powers off the DSP (D3) after a timeout. Tests have little control on this timeout. Also, it's possible (and even recommended by the logger docs) to disable D3 and it would simpler from a test perspective if logging behavior is not totally different when disabling D3 (of course content differences are unavoidable). So given a choice, I think I prefer logs to be never empty as long as the DSP has booted at least once in the past. Logs obviously provide more information than no logs and this matches other tools like
Sounds good, thanks.
Good idea, I'll try to find some time and do that. I'm already familiar with that code. Is there some inotify-like API you would recommend to avoid polling |
Rescuing from a private email thread a non-intuitive (to me)
Which is pretty much expected based on the kernel code: -- sleep 1 --
-- sleep 3 --
|
Another useful explanation from @ujfalusi |
Don't fail immediately when the driver is not loaded. Use inotify instead to wait for /sys/kernel/debug/sof/[e]trace to appear. This makes it possible to start before the driver is loaded which reduces considerably the chances of missing early logs. Fixes a small part of thesofproject/linux#3275 Signed-off-by: Marc Herbert <[email protected]>
Don't fail immediately when the driver is not loaded. Use inotify instead to wait for /sys/kernel/debug/sof/[e]trace to appear. This makes it possible to start before the driver is loaded which reduces considerably the chances of missing early logs. Fixes a small part of thesofproject/linux#3275 Signed-off-by: Marc Herbert <[email protected]>
Don't fail immediately when the driver is not loaded. Use inotify instead to wait for /sys/kernel/debug/sof/[e]trace to appear. This makes it possible to start before the driver is loaded which reduces considerably the chances of missing early logs. Fixes a small part of thesofproject/linux#3275 Signed-off-by: Marc Herbert <[email protected]>
Don't fail immediately when the driver is not loaded. Use inotify instead to wait for /sys/kernel/debug/sof/[e]trace to appear. This makes it possible to start before the driver is loaded which reduces considerably the chances of missing early logs. Fixes a small part of thesofproject/linux#3275 Signed-off-by: Marc Herbert <[email protected]> (cherry picked from commit dcf0577)
Don't fail immediately when the driver is not loaded. Use inotify instead to wait for /sys/kernel/debug/sof/[e]trace to appear. This makes it possible to start before the driver is loaded which reduces considerably the chances of missing early logs. Fixes a small part of thesofproject/linux#3275 Signed-off-by: Marc Herbert <[email protected]> (cherry picked from commit dcf0577)
As documented in thesofproject/sof-docs#381 and discussed at length in thesofproject/sof-test#802 (comment) , current DMA trace is not designed to support the scenario where DMA tracing is started by user-space (sof-logger) while the DSP is in fact running. The current kernel driver allows to do this, but logs are provided in best-effort manner.
For development purposes, getting some traces is better than not getting any traces. When used for validation, lack of determinism is a problem. A specific problem for validation is how to capture early traces reliable. The sof-logger cannot be started when SOF driver is not loaded. But when SOF driver is loaded, then the DSP might be already be powered on. This leaves a race that cannot be easily handled in user-space.
Improve the kernel tracing interface to guarantee:
- driver needs to hide runtime-suspend transitions of DSP
- if the ringbuffer has wrapped while sof-logger was not running, the returned traces must still be in order
FYI @marc-hb @ujfalusi @plbossart @lgirdwood
The text was updated successfully, but these errors were encountered: