You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[LNL]Suspend resume with playback or capture will Fail or TIMEOUT #5080
Failure logs are a bit unclear w.r.t. where things start to go south. The last messages to FW seem sane, cores are powered down, finally SET_DX is sent without errors. But then there's a generic kernel pm -EBUSY error for late_suspend (one example, Intel test run 43010):
[ 408.720709] kernel: snd_sof_intel_hda_common:hda_dsp_state_log: sof-audio-pci-intel-lnl 0000:00:1f.3: Current DSP power state: D3
[ 408.720720] kernel: snd_sof:sof_set_fw_state: sof-audio-pci-intel-lnl 0000:00:1f.3: fw_state change: 7 -> 0
[ 412.467352] kernel: PM: late suspend of devices failed
Running more tests to get insights on the failures.
wow, that's quite a corner case: an xrun while suspend, no one saw that coming.
the part that I am not following is that the xrun seems to be reproducible, which suggests some sort of D0i3 problem in the first place.
Also if the PCM device is stopped before a system suspend, it's not clear to me what userspace will do on resume? Would it go on with a prepare/trigger? or would there be an additional stage of hw_free/hw_params?
@plbossart I'll try to see if this is completely reproducible, but indeed the xrun seems to start the chain of failures. The user-space will continue xrun handling as soon as resume is complete:
# PCM31 is prepared just before user-space is suspended
[ 889.160611] snd_sof:sof_widget_free_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget pipeline.2 freed
[ 889.160621] snd_sof:sof_widget_free_unlocked: sof-audio-pci-intel-lnl 0000:00:1f.3: widget dai-copier.SSP.NoCodec-0.playback freed
[ 889.160638] snd_sof:sof_pcm_prepare: sof-audio-pci-intel-lnl 0000:00:1f.3: pcm: prepare stream 31 dir 0
[ 889.160641] snd_sof:sof_pcm_hw_params: sof-audio-pci-intel-lnl 0000:00:1f.3: pcm: hw params stream 31 dir 0
# then we enter suspend
[ 889.311599] ACPI: EC: interrupt blocked
[ 893.102613] ACPI: EC: interrupt unblocked
# resume starts, DSP is booted
[ 893.207454] snd_sof:snd_sof_run_firmware: sof-audio-pci-intel-lnl 0000:00:1f.3: firmware boot complete
[ 893.207465] snd_sof:sof_set_fw_state: sof-audio-pci-intel-lnl 0000:00:1f.3: fw_state change: 6 -> 7
# system resume completes in kernel and resumes user-space
[ 893.616716] OOM killer enabled.
[ 893.616721] Restarting tasks ...
# upon resume prepare is called AGAIN on the PCM31 (this is normal after system suspend)
[ 893.618603] snd_sof:sof_pcm_prepare: sof-audio-pci-intel-lnl 0000:00:1f.3: pcm: prepare stream 31 dir 0
[ 893.618613] snd_sof:sof_pcm_hw_params: sof-audio-pci-intel-lnl 0000:00:1f.3: pcm: hw params stream 31 dir 0
# to my eyes, the DSP pipeline setup goes just fine, no errors from the IPCs
# then FE PCM START trigger fals and I see no errors from SOF
[ 893.639609] snd_sof_intel_hda_common:hda_dai_trigger: sof-audio-pci-intel-lnl 0000:00:1f.3: cmd=1 dai SSP0 Pin direction 0
[ 893.639621] sof-audio-pci-intel-lnl 0000:00:1f.3: ASoC: error at soc_dai_trigger on SSP0 Pin: -22
[ 893.648704] Deepbuffer Port0: ASoC: trigger FE cmd: 1 failed: -22
# then we just see user-space tearing down the PCM
In user-space console, this shows as:
rtcwake: wakeup from "mem" using /dev/rtc0 at Wed Jun 26 19:20:20 2024
underrun!!! (at least 1028.938 ms long)
2024-06-26 19:20:20 UTC Sub-Test: [COMMAND] sleep for 5
aplay: pcm_write:2127: write error: Input/output error
So opens are at least why the xrun occurs in the first place (deep buffer, D0i3 mode entry, ...), and second is the why the prepare is called twice and is the flow correct here (I have a hunch the double-prepare confuses the driver state somewhere and thus we get the -22 from FE trigger on the resume).
hit the condition (=suspend with substream present) with D0ix disabled (streams marked not compatible with D0ix)
hit the condition once without a preceding xrun
For the latter, I can't really explain why this happens yet. There's a trigger to stop the PCM right after suspend starts but nothing printed out by aplay so this is coming from ALSA core:
It seems the failure sequence is related to a system hickup in system process. Whenever SOF see unexpected sequence (no SUSPEND action for the DAI), there is unexpected 2sec gap in the system suspend process. This often generates an xrun, but exact sequence depends on the length of the gap:
# success case, completes within 10ms
[69489.712206] Filesystems sync: 0.001 seconds
[69489.717798] Freezing user space processes
[69489.719699] Freezing user space processes completed (elapsed 0.001 seconds)
# success case:
[69500.740018] Filesystems sync: 0.001 seconds
[69500.745193] Freezing user space processes
[69500.747031] Freezing user space processes completed (elapsed 0.001 seconds)
# success case:
[69511.757591] Filesystems sync: 0.001 seconds
[69511.761816] Freezing user space processes
[69511.763580] Freezing user space processes completed (elapsed 0.001 seconds)
# FAILURE case (without #5085 , kernel would crash here)
[69522.814773] Filesystems sync: 0.001 seconds
# note the 2second gap! user-space will stop the PCM after xrun and this is done before user-space is frozen
[69524.304214] Freezing user space processes
[69524.305612] Freezing user space processes completed (elapsed 0.001 seconds)
So the SET_PIPELNE response is not seen by host. This only happens when the system suspend process has the unusual delay, so something unusual going on on the host system side. I'll keep the bug on driver side until we get more insight on what happens with the suspend.
Activity
kv2019i commentedon Jun 24, 2024
Failure logs are a bit unclear w.r.t. where things start to go south. The last messages to FW seem sane, cores are powered down, finally SET_DX is sent without errors. But then there's a generic kernel pm -EBUSY error for late_suspend (one example, Intel test run 43010):
Running more tests to get insights on the failures.
kv2019i commentedon Jun 26, 2024
Digging further into scenario #5085 addresses, it seems following combination of events happens:
Example log
PR #5085 will avoid the kernel crash, but the xrun handling concurrently with system suspend is not successful and the streaming later terminates to:
plbossart commentedon Jun 27, 2024
wow, that's quite a corner case: an xrun while suspend, no one saw that coming.
the part that I am not following is that the xrun seems to be reproducible, which suggests some sort of D0i3 problem in the first place.
Also if the PCM device is stopped before a system suspend, it's not clear to me what userspace will do on resume? Would it go on with a prepare/trigger? or would there be an additional stage of hw_free/hw_params?
kv2019i commentedon Jun 27, 2024
@plbossart I'll try to see if this is completely reproducible, but indeed the xrun seems to start the chain of failures. The user-space will continue xrun handling as soon as resume is complete:
In user-space console, this shows as:
So opens are at least why the xrun occurs in the first place (deep buffer, D0i3 mode entry, ...), and second is the why the prepare is called twice and is the flow correct here (I have a hunch the double-prepare confuses the driver state somewhere and thus we get the -22 from FE trigger on the resume).
ASoC: SOF: Intel: hda: fix null deref on system suspend entry
kv2019i commentedon Jun 27, 2024
Some refinements:
For the latter, I can't really explain why this happens yet. There's a trigger to stop the PCM right after suspend starts but nothing printed out by aplay so this is coming from ALSA core:
kv2019i commentedon Jun 27, 2024
It seems the failure sequence is related to a system hickup in system process. Whenever SOF see unexpected sequence (no SUSPEND action for the DAI), there is unexpected 2sec gap in the system suspend process. This often generates an xrun, but exact sequence depends on the length of the gap:
kv2019i commentedon Jun 28, 2024
With the kernel fix in place, we now see similar occurences in CI with suspend taking longer than expected and following error in log:
kernel:
FW:
So the SET_PIPELNE response is not seen by host. This only happens when the system suspend process has the unusual delay, so something unusual going on on the host system side. I'll keep the bug on driver side until we get more insight on what happens with the suspend.
bardliao commentedon Jun 28, 2024
Is it possible that FW dead before it sent the response? Like, it dead when it process the MOD_UNBIND command.
ASoC: SOF: Intel: hda: fix null deref on system suspend entry
ASoC: SOF: Intel: hda: fix null deref on system suspend entry
78 remaining items
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
kv2019i commentedon Dec 13, 2024
Not seen in PR/daily tests for a week, closing.
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()
ASoC: SOF: Intel: hda: fix null deref on system suspend entry
ASoC: SOF: Intel: hda: handle only paused streams in hda_dai_suspend()