From: Takashi Iwai <tiwai@suse.de>
To: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: pcm: fix wait_time calculations
Date: Thu, 06 Apr 2023 17:01:20 +0200 [thread overview]
Message-ID: <877cupt5q7.wl-tiwai@suse.de> (raw)
In-Reply-To: <20230405201219.2197774-1-oswald.buddenhagen@gmx.de>
On Wed, 05 Apr 2023 22:12:19 +0200,
Oswald Buddenhagen wrote:
>
> ... in wait_for_avail() and snd_pcm_drain().
>
> t was calculated in seconds, so it would be pretty much always zero, to
> be subsequently de-facto ignored due to being max(t, 10)'d. And then it
> (i.e., 10) would be treated as secs, which doesn't seem right.
>
> However, fixing it to properly calculate msecs would potentially cause
> timeouts when using twice the period size for the default timeout (which
> seems reasonable to me), so instead use the buffer size plus 10 percent
> to be on the safe side ... but that still seems insufficient, presumably
> because the hardware typically needs a moment to fire up. To compensate
> for this, we up the minimal timeout to 100ms, which is still two orders
> of magnitude less than the bogus minimum.
>
> substream->wait_time was also misinterpreted as jiffies, despite being
> documented as being in msecs. Only the soc/sof driver sets it - to 500,
> which looks very much like msecs were intended.
>
> Speaking of which, shouldn't snd_pcm_drain() also use substream->
> wait_time?
Yes, and unifying the code might make more sense.
> As a drive-by, make the debug messages on timeout less confusing.
>
> Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
I applied this patch as is now to for-next branch.
thanks,
Takashi
next prev parent reply other threads:[~2023-04-06 15:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-05 20:12 [PATCH] ALSA: pcm: fix wait_time calculations Oswald Buddenhagen
2023-04-06 15:01 ` Takashi Iwai [this message]
2023-06-12 12:18 ` Jon Hunter
2023-06-12 13:16 ` Jon Hunter
2023-06-12 14:28 ` Oswald Buddenhagen
2023-06-12 16:03 ` Jon Hunter
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=877cupt5q7.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=oswald.buddenhagen@gmx.de \
/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