From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Sergey Tiraspolsky <stiraspo@gmail.com>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
Peter Ujfalusi <peter.ujfalusi@linux.intel.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
Mark Brown <broonie@kernel.org>,
"Jaroslav Kysela" <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ASoC: Intel: avs: Reset the stream unless it is already prepared
Date: Mon, 12 Oct 2026 16:58:22 +0200 [thread overview]
Message-ID: <c49edd0f-030c-4ac1-a0df-34d100337a53@intel.com> (raw)
In-Reply-To: <20261010103753.16969-1-stiraspo@gmail.com>
On 10/10/2026 12:37 PM, Sergey Tiraspolsky wrote:
> Commit cfca1637bc2b ("ASoC: Intel: avs: Unprepare a stream when XRUN
> occurs") resets the HDA stream when ->prepare() is called in the XRUN
> state. User space does not always recover that way. PipeWire's ALSA
> backend recovers from an underrun with snd_pcm_drop(), snd_pcm_prepare()
> and a new start, so ->prepare() runs in the SETUP state,
> hdac_stream->prepared is still set and the reset is skipped. Every
> recovery attempt then fails the same way:
>
> spa.alsa: hw:avsmax98927,1p: snd_pcm_avail after recover: Broken pipe
>
> On a Google Pixelbook (Kaby Lake, max98927 speakers) this happens after
> an occasional underrun during normal playback and silences the speakers
> for one to four minutes, until the PCM is closed. It can be provoked by
> stopping PipeWire with SIGSTOP for 0.5 s during playback: in one run
> that single underrun led to 1297 failed recoveries over two minutes,
> until the sink was suspended. A plain alsa-lib program that recovers
> with snd_pcm_drop() and snd_pcm_prepare() hits the same loop, while
> snd_pcm_prepare() straight from XRUN recovers at once.
The patch looks outstanding! Thank you not only for the fix, but for the
thorough explanation and the reproduction technique too.
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
> Fixes: cfca1637bc2b ("ASoC: Intel: avs: Unprepare a stream when XRUN occurs")
While I prefer to leave Fixes: tag here so it may get populated
downstream, this is in fact a complementing fix, not a fix for a fix.
IIRC recovery on alsa-lib side is handled with either:
1) snd_pcm_prepare(state=XRUN)
2) snd_pcm_drop/drain() -> snd_pcm_prepare(state=SETUP)
Without the commit mentioned here, 1) and 2) are both unaccounted for.
With the commit, 1) gets accounted for. By adding the change of yours to
the mix, 1) and 2) should be accounted for.
I'll prepare an equivalent change for the HDAudio BackEnd side as well
as re-check whether ->prepared and ->link_prepared flags are actually
needed once the fixes are applied.
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Sergey Tiraspolsky <stiraspo@gmail.com>
Kind regards,
Czarek
next prev parent reply other threads:[~2026-10-12 14:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-10 10:37 Sergey Tiraspolsky
2026-10-12 14:58 ` Cezary Rojewski [this message]
2026-10-12 18:01 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c49edd0f-030c-4ac1-a0df-34d100337a53@intel.com \
--to=cezary.rojewski@intel.com \
--cc=broonie@kernel.org \
--cc=kai.vehmanen@linux.intel.com \
--cc=liam.r.girdwood@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peter.ujfalusi@linux.intel.com \
--cc=pierre-louis.bossart@linux.dev \
--cc=stiraspo@gmail.com \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®