Repository navigation
Conversation
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.
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
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
| timeout -k 2 5 aplay "${params[@]}" \ | ||
| -D "plughw:$cardnum,$dev" /dev/zero \ | ||
| >/dev/null 2>&1 && return 0 |
There was a problem hiding this comment.
This is not valid. The test sequence synchronously waits until card is probe and registered. Then this ping is called to force the DSP to boot. This function will exit immediately when a PCM is succesfully opened. Then sof_loggers will immediately start mtrace-reader (or other tool). This leaves for 2secs of time to start capturing logs. A more robust change would be require to run logger in background and then force DSP boot with aplay/arecord. That is better done in separate PR if needed. The current PR fixes a clear bug introduced with recent LInux, so I think this is good to go. FYI @lgirdwood
lgirdwood
left a comment
There was a problem hiding this comment.
LGTM, but giving a little more time for the PCM is probably needed.
|
|
||
| for cardpath in /proc/asound/card[0-9]*; do | ||
| # SOF card ids start with "sof", see sof_alsa_card_found() | ||
| case $(cat "$cardpath/id" 2>/dev/null) in |
There was a problem hiding this comment.
Maybe
grep -q '^sof' "$cardpath/id" 2>/dev/null || continueBTW why discard stderr, what error is expected? Discarding stderr is evil, should be justified every time :-)
| else | ||
| timeout -k 2 5 arecord "${params[@]}" \ | ||
| -D "plughw:$cardnum,$dev" /dev/null \ | ||
| >/dev/null 2>&1 && return 0 |
There was a problem hiding this comment.
Same: why discard stderr, what sort of spurious error message is expected?
| local mtracetool="$MTRACE" | ||
|
|
||
| # Make sure the DSP is active before the reader attaches | ||
| ping_pcm_devices |
There was a problem hiding this comment.
I feel like this is significantly different from the rest to deserve a separate commit IMHO
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.

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.