From: "Cássio Gabriel Monteiro Pires" <cassiogabrielcontato@gmail.com>
To: Mark Brown <broonie@kernel.org>
Cc: Takashi Iwai <tiwai@suse.com>, Vinod Koul <vkoul@kernel.org>,
Jaroslav Kysela <perex@perex.cz>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] ALSA: compress: Propagate real pointer errors in avail paths
Date: Tue, 14 Apr 2026 14:45:52 -0300 [thread overview]
Message-ID: <1720a3a0-2754-4f12-97b0-5304358e0e54@gmail.com> (raw)
In-Reply-To: <0340e472-b0a7-4bc7-bba8-a581784b8e3a@sirena.org.uk>
[-- Attachment #1.1: Type: text/plain, Size: 2619 bytes --]
On 4/14/26 13:53, Mark Brown wrote:
> On Tue, Apr 14, 2026 at 01:47:54PM -0300, Cássio Gabriel wrote:
>
>> Commit 61327f3d817c ("ALSA: compress: Pay attention if drivers
>> error out retrieving pointers") made snd_compr_update_tstamp()
>> return driver pointer() failures, but snd_compr_calc_avail()
>> still ignores that status and continues with stale runtime
>> counters.
>
>> The fallback for an unsupported pointer callback remains
>> intentional, so keep ignoring -EOPNOTSUPP there. Propagate
>> real pointer-refresh failures instead.
>
>> -static size_t snd_compr_calc_avail(struct snd_compr_stream *stream,
>> - struct snd_compr_avail64 *avail)
>> +static int snd_compr_calc_avail(struct snd_compr_stream *stream,
>> + struct snd_compr_avail64 *avail)
>> {
>> + int ret;
>> +
>> memset(avail, 0, sizeof(*avail));
>> - snd_compr_update_tstamp(stream, &avail->tstamp);
>> - /* Still need to return avail even if tstamp can't be filled in */
>> + ret = snd_compr_update_tstamp(stream, &avail->tstamp);
>> + if (ret < 0 && ret != -EOPNOTSUPP)
>> + return ret;
>> + /* Still need to return avail when no timestamp is available */
>
> It's not clear to me that the intent there is to only ignore in the case
> where we fail to update due to the operation not being supported rather
> than to also ignore any other runtime errors we might encounter (eg, due
> to the stream configuration).
Cool, thanks for replying!
I rechecked the current tree, and the hard-failure class does exist:
wm_adsp_compr_pointer() can return -EIO and switch the stream to
XRUN when dsp->fatal_error, !buf, or buf->error, so that is a
real in-tree case where pointer() failure means the stream itself is
broken rather than timestamp data simply being unavailable.
That said, I agree this does not fully justify the generic change as I
sent it. In particular, SNDRV_COMPRESS_AVAIL and poll() both recheck
the stream state after the pointer refresh, and there are other drivers
such as SOF where pointer() can return -EBUSY for a not-ready case,
which is not the same class as the wm_adsp -EIO/XRUN path.
I also agree that the current patch is too broad because it uses the raw pointer()
errno as the policy boundary for avail handling, and that conflates hard
stream-failure cases such as wm_adsp's -EIO/XRUN transition with
other conditions like SOF's -EBUSY not-ready return. I can rework patch
2 so the behavior is based on a better-defined failure condition instead
of treating every non-EOPNOTSUPP return as fatal for avail.
WDYT?
--
Thanks,
Cássio
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
next prev parent reply other threads:[~2026-04-14 17:45 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-14 16:47 [PATCH 0/2] ALSA: compress: clean up pointer errno handling and fix avail errors Cássio Gabriel
2026-04-14 16:47 ` [PATCH 1/2] ALSA: compress: Use EOPNOTSUPP for missing pointer callbacks Cássio Gabriel
2026-04-14 16:47 ` [PATCH 2/2] ALSA: compress: Propagate real pointer errors in avail paths Cássio Gabriel
2026-04-14 16:53 ` Mark Brown
2026-04-14 17:45 ` Cássio Gabriel Monteiro Pires [this message]
2026-04-15 14:20 ` Takashi Iwai
2026-04-15 19:29 ` Cássio Gabriel Monteiro Pires
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=1720a3a0-2754-4f12-97b0-5304358e0e54@gmail.com \
--to=cassiogabrielcontato@gmail.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=vkoul@kernel.org \
/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®