From: Takashi Iwai <tiwai@suse.de>
To: Koro Chen <koro.chen@mediatek.com>
Cc: <matthias.bgg@gmail.com>, <broonie@kernel.org>, <perex@perex.cz>,
<srv_heupstream@mediatek.com>,
<linux-mediatek@lists.infradead.org>, <s.hauer@pengutronix.de>,
<linux-arm-kernel@lists.infradead.org>,
<linux-kernel@vger.kernel.org>, <alsa-devel@alsa-project.org>
Subject: Re: [RFC PATCH] ALSA: pcm: Modify double acknowledged interrupts check condition
Date: Tue, 19 May 2015 09:34:47 +0200 [thread overview]
Message-ID: <s5hfv6t10mg.wl-tiwai@suse.de> (raw)
In-Reply-To: <1431527943-64178-1-git-send-email-koro.chen@mediatek.com>
At Wed, 13 May 2015 22:39:03 +0800,
Koro Chen wrote:
>
> Currently in snd_pcm_update_hw_ptr0 during interrupt,
> we consider there were double acknowledged interrupts when:
> 1. HW reported pointer is smaller than expected, and
> 2. Time from last update time (hdelta) is over half a buffer time.
>
> However, when HW reported pointer is only a few bytes smaller than
> expected, and when hdelta is just a little larger than half a buffer time
> (e.g. ping-pong buffer), it wrongly treats this IRQ as double acknowledged.
>
> The condition #2 uses jiffies, but jiffies is not high resolution
> since it is integer. We should consider jiffies inaccuracy.
>
> Signed-off-by: Koro Chen <koro.chen@mediatek.com>
The condition looks too strict, indeed. I applied the patch as is
now.
BTW, the similar check is already present for the free-wheeling case.
I'm going to clean up the code a bit for using the common code.
thanks,
Takashi
> ---
> sound/core/pcm_lib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
> index ac6b33f..7d45645 100644
> --- a/sound/core/pcm_lib.c
> +++ b/sound/core/pcm_lib.c
> @@ -339,7 +339,7 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
> if (delta > new_hw_ptr) {
> /* check for double acknowledged interrupts */
> hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
> - if (hdelta > runtime->hw_ptr_buffer_jiffies/2) {
> + if (hdelta > runtime->hw_ptr_buffer_jiffies/2 + 1) {
> hw_base += runtime->buffer_size;
> if (hw_base >= runtime->boundary) {
> hw_base = 0;
> --
> 1.8.1.1.dirty
>
prev parent reply other threads:[~2015-05-19 7:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-13 14:39 [RFC PATCH] ALSA: pcm: Modify double acknowledged interrupts check condition Koro Chen
2015-05-19 7:34 ` Takashi Iwai [this message]
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=s5hfv6t10mg.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=koro.chen@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=s.hauer@pengutronix.de \
--cc=srv_heupstream@mediatek.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;
as well as URLs for NNTP newsgroup(s).