Repository navigation
check-sof-logger.sh: use a short stream in ping_pcm_devices() - #1371
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
PCM fallback probing can exceed the logger capture window, causing a later working PCM’s DSP activity to be missed; probing must complete before capture starts or reader lifetime must cover the full sequence.
1 open issue
What changed in this PR
This PR updates the SOF logger test to wake the DSP with a real audio stream, addressing empty logs when drivers use on-demand DSP boot.
Changes:
- Replace raw PCM-node reads with one-second playback or capture streams using
plughw. - Try SOF PCM devices until one succeeds, warning if none work.
- Wake the DSP before starting
mtrace-reader.py.
| File | Description |
|---|---|
test-case/check-sof-logger.sh |
Adds stream-based DSP wake-up and a pre-mtrace wake-up call. |
Review effort: Balanced
lgirdwood
left a comment
There was a problem hiding this comment.
LGTM, but giving a little more time for the PCM is probably needed.
marc-hb
left a comment
There was a problem hiding this comment.
As a result, loggers could end up attached to a suspended DSP and the log output was empty.
... and tests were passing? More "green failures" :-(
I remember working hard to detect empty logs, is that not working anymore? This would be an different issue than this PR - but a (nth repeat of) a serious one.
37b67f9 to
018546b
Compare
|
V2 pushed:
|
SOF Linux driver introduced support for on-demand booting of DSP in
upstream Linux commit c3e154981174 ("ASoC: SOF: Add support for
on-demand DSP boot"). This broke the check-sof-logger.sh function to
ping PCM devices with dd. As a result, loggers could end
up attached to a suspended DSP and the log output was empty.
Run a short (1s) silent stream with aplay, or arecord as a fallback, on
the PCMs of the SOF cards until one succeeds. The PCMs are found from
/proc/asound and plughw is used to let ALSA pick working parameters, so
this does not depend on the hardware or the topology. Failing PCMs are
skipped with the tool error message logged, and only a warning is
printed if none could be opened.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
018546b to
5492eb2
Compare
|
V3 pushed:
|
| grep -q '^sof' "$cardpath/id" || continue | ||
| cardnum=${cardpath##*card} | ||
|
|
||
| for pcm in "$cardpath"/pcm[0-9]*[pc]; do |
There was a problem hiding this comment.
to get out the fw boot log why do you need to ping all of the PCMs of the card?
There was a problem hiding this comment.
@ujfalusi ? the test doesn't do this, see L135
| # to what the PCM supports. Failing PCMs, e.g. HDMI without a | ||
| # monitor, are expected. | ||
| local cardpath cardnum pcm dev dir tool err | ||
| local params=(-q -t raw -f S16_LE -r 48000 -c 2 -d 1) |
There was a problem hiding this comment.
-fS16_LE -r48000 -c2 == -fdat
There was a problem hiding this comment.
I prefer to be explicit here, no need to save characters typing here
| for pcm in "$cardpath"/pcm[0-9]*[pc]; do | ||
| test -e "$pcm" || continue | ||
| dev=${pcm##*/pcm} # e.g. 12p | ||
| dir=${dev: -1} |
There was a problem hiding this comment.
| dir=${dev: -1} | |
| dir=${dev: -1} # last character thanks to substring expansion |
This syntax is valid and useful but very cryptic for non-shell experts. What is especially cryptic: it's totally different from ${dev:-1}!
An audio expert can guess the intent and "reverse-engineer" it but that's not ideal.
harajend
left a comment
There was a problem hiding this comment.
The CI run for this PR used sof-test commit 5492eb2 and failed in check-sof-logger on ba-wclu-rvp-08 (job log). The test log shows mtrace-reader.py exiting immediately with FileNotFoundError for /sys/kernel/debug/sof/mtrace/core0; logger.etrace.txt is empty. The other test cases in the suite passed.
run_loggers() starts the mtrace reader before calling ping_pcm_devices(). If the mtrace node is unavailable until the PCM activity wakes the on-demand DSP, the reader may exit before that wakeup occurs. Could we ensure the DSP is awake and the mtrace node exists before starting the reader, or retry the reader after the PCM wakeup? The log does report firmware boot complete, so it would also help to confirm whether this DUT/kernel configuration is expected to expose that debugfs node. Please rerun check-sof-logger on the affected setup after addressing or explaining this failure.
|
@harajend wrote:
I checked the failing case and device and this is caused by invalid test device configuration. Check of "cat /sys/module/snd_sof/parameters/sof_debug" shows FW logs are not enabled so mtrace is not enabled. So not related to this PR. |

SOF SOF Linux driver introduced support for on-demand booting of DSP in upstream Linux commit c3e154981174 ("ASoC: SOF: Add support for on-demand DSP boot"). This broke the check-sof-logger.sh function to ping PCM devices with dd. As a result, loggers could end up attached to a suspended DSP and the log output was empty.
Run a short (1s) silent stream with aplay, or arecord as a fallback, on the PCMs of the SOF cards until one succeeds. The PCMs are found from /proc/asound and plughw is used to let ALSA pick working parameters, so this does not depend on the hardware or the topology. Failing PCMs are skipped, and only a warning is printed if none could be opened.
Also wake up the DSP before starting mtrace-reader.py, in addition to the existing call that generates DSP activity while the loggers run.Removed in V2.