From: Takashi Iwai <tiwai@suse.de>
To: "Lu, Brent" <brent.lu@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"Jaroslav Kysela" <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Baolin Wang <baolin.wang@linaro.org>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Richard Fontana <rfontana@redhat.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
paulhsia <paulhsia@chromium.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ALSA: pcm: fix incorrect hw_base increase
Date: Fri, 15 May 2020 12:40:42 +0200 [thread overview]
Message-ID: <s5himgxmqfp.wl-tiwai@suse.de> (raw)
In-Reply-To: <BN6PR1101MB213283BD74AA4477B18C96CD97BD0@BN6PR1101MB2132.namprd11.prod.outlook.com>
On Fri, 15 May 2020 11:36:19 +0200,
Lu, Brent wrote:
>
> >
> > Updating hw_ptr_jiffies at that code path looks correct, but it still leaves the
> > question why this condition happens. It means that the actual hwptr isn't
> > changed and yet only jiffies increase significantly; it means that the hardware
> > can't report proper pointer, and it should have set
> > SNDRV_PCM_INFO_BATCH flag, then the jiffies check is skipped.
> >
> > With which hardware and under which situation did it happen (and the patch
> > fixed)?
> >
> >
> > thanks,
> >
> > Takashi
> >
>
> >From time to time we got questions from google about why sometimes the
> snd_pcm_avail() returns a value larger than buffer size. Recently we finally
> found reliable reproduce steps: it's on Intel GLK Chromebook Fleex with
> SOF firmware. There is a 1/20 chance the audio playback to HDMI fails.
>
> >From the FW side we observe a buffer runderrun, the FW is not able to
> recover it for some reason and stops the pipe.
>
> >From the Linux side we see the pos does not increase because the FW stops
> receiving data but suddenly the hw_prt is increased by buffer_size (16368).
> It could make snd_pcm_avail() reporting a false underrun to the caller like
> following log:
>
> 2020-05-09T16:08:32.712042+08:00 DEBUG kernel: [ 418.510086] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368
> 2020-05-09T16:08:32.712043+08:00 DEBUG kernel: [ 418.510149] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6910 avail 9554
> ...
> 2020-05-09T16:08:32.883095+08:00 DEBUG kernel: [ 418.680868] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362
> 2020-05-09T16:08:32.883104+08:00 DEBUG kernel: [ 418.681052] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362
> 2020-05-09T16:08:32.883109+08:00 DEBUG kernel: [ 418.681130] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
> 2020-05-09T16:08:32.929330+08:00 DEBUG kernel: [ 418.726515] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368
> 2020-05-09T16:08:32.929512+08:00 DEBUG kernel: [ 418.727041] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368
>
> Or it could make snd_pcm_avail() returns an invalid number and confuses the
> Caller like following log:
>
> 2020-05-09T16:08:33.054039+08:00 DEBUG kernel: [ 418.851755] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 27390 avail 5442
> 2020-05-09T16:08:33.129552+08:00 DEBUG kernel: [ 418.926491] sound pcmC0D5p: pos 96 hw_ptr 32832 appl_ptr 27390 avail 21810
> 2020-05-09T16:08:33.131746+08:00 ERR cras_server[1907]: pcm_avail returned frames larger than buf_size: sof-glkda7219max: :0,5: 21810 > 16368
>
> I've submitted a patch to fix the issue in SOF side. However, I think it's also good
> to fix the incorrect hw_base increasement in Linux side.
>
> https://github.com/thesofproject/sof/pull/2926
Oh this whole information (at least some digested version) should have
been included in the patch description. Otherwise we have no idea why
it's needed and what actually means.
Let's wait for Jaroslav's review, and if it's OK, could you resubmit
with more description?
thanks,
Takashi
prev parent reply other threads:[~2020-05-15 10:40 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-15 4:09 [PATCH] ALSA: pcm: fix incorrect hw_base increase Brent Lu
2020-05-15 7:04 ` Greg Kroah-Hartman
2020-05-15 9:04 ` Lu, Brent
2020-05-15 9:30 ` Jaroslav Kysela
2020-05-15 10:39 ` Takashi Iwai
2020-05-15 12:01 ` Jaroslav Kysela
2020-05-18 4:38 ` Lu, Brent
2020-05-15 7:21 ` Takashi Iwai
2020-05-15 9:36 ` Lu, Brent
2020-05-15 10:40 ` 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=s5himgxmqfp.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=baolin.wang@linaro.org \
--cc=brent.lu@intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=paulhsia@chromium.org \
--cc=perex@perex.cz \
--cc=rfontana@redhat.com \
--cc=tglx@linutronix.de \
--cc=tiwai@suse.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