ASoC: Intel: avs: DSP recovery and resume fixes
Subsystems (3)
Cezary Rojewski
maintainerv3 cover ASoC: Intel: avs: DSP recovery and resume fixes
Two fixes that are result of the recent discussions [1][2].
First adds missing locking around snd_pcm_stop() while the second fix sets substream state to DISCONNECTED if any suspend/resume related operation fails so that userspace has means to be aware that something went wrong during said operation.
Changes in v3:
- added a comment why non-_irq() locking is used around snd_pcm_stop()
Changes in v2:
- __snd_pcm_set_state() replaced direct assignments of PCM state
[1]: https://lore.kernel.org/alsa-devel/[email protected]/
[2]: https://lore.kernel.org/alsa-devel/[email protected]/
Cezary Rojewski (2):
ASoC: Intel: avs: Lock substream before snd_pcm_stop()
ASoC: Intel: avs: Disconnect substream if suspend or resume fails
sound/soc/intel/avs/ipc.c | 3 +++ sound/soc/intel/avs/pcm.c | 10 ++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-)
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 1/2 ASoC: Intel: avs: Lock substream before snd_pcm_stop()
snd_pcm_stop() shall be called with stream lock held to prevent any races between nonatomic streaming operations.
---
Changes in v3:
- added a comment why non-_irq() locking is used around snd_pcm_stop()
sound/soc/intel/avs/ipc.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/intel/avs/ipc.c +3 -0
@@ -123,7 +123,10 @@ static void avs_dsp_recovery(struct avs_dev *adev)if (!substream || !substream->runtime)continue ; +/* No need for _irq() as we are in nonatomic context. */ +snd_pcm_stream_lock (substream);snd_pcm_stop (substream,SNDRV_PCM_STATE_DISCONNECTED ); +snd_pcm_stream_unlock (substream); } } }
Signature · 1 line
2.25.1
Cezary Rojewski
maintainerPATCH v3 2/2 ASoC: Intel: avs: Disconnect substream if suspend or resume fails
In reply to Cezary RojewskiTo improve performance and overall system stability, suspend/resume operations for ASoC cards always return success status and defer the actual work.
Because of that, if a substream fails to resume, userspace may still attempt to invoke commands on it as from their perspective the operation completed successfully. Set substream's state to DISCONNECTED to ensure no further commands are attempted.
---
Changes in v2:
- __snd_pcm_set_state() replaced direct assignments of PCM state
sound/soc/intel/avs/pcm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
sound/soc/intel/avs/pcm.c +8 -2
@@ -934,8 +934,11 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be, rtd =snd_pcm_substream_chip (data->substream);if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) { ret =op (dai, data); -if (ret <0 ) +if (ret <0 ) { +__snd_pcm_set_state (data->substream->runtime, +SNDRV_PCM_STATE_DISCONNECTED );return ret; + } } }
@@ -944,8 +947,11 @@ static int avs_component_pm_op(struct snd_soc_component *component, bool be, rtd =snd_pcm_substream_chip (data->substream);if (rtd->dai_link->no_pcm == be && !rtd->dai_link->ignore_suspend) { ret =op (dai, data); -if (ret <0 ) +if (ret <0 ) { +__snd_pcm_set_state (data->substream->runtime, +SNDRV_PCM_STATE_DISCONNECTED );return ret; + } } } }
Signature · 1 line
2.25.1
Mark Brown
maintainerQuoted 8 lines · Cezary Rojewski
Two fixes that are result of the recent discussions [1][2].
First adds missing locking around
snd_pcm_stop()while the second fix sets substream state to DISCONNECTED if any suspend/resume related operation fails so that userspace has means to be aware that something went wrong during said operation.[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoC: Intel: avs: Lock substream before snd_pcm_stop()
commit: c30c8f9d51ec24b36e2c65a6307a5c8cbc5a0ebc
[2/2] ASoC: Intel: avs: Disconnect substream if suspend or resume fails
commit: f3fbb553f98563f692e356aca87d656baba910a0All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark