From: Takashi Iwai <tiwai@suse.de>
To: Alexander Tsoy <alexander@tsoy.me>
Cc: Gregor Pintar <grpintar@gmail.com>, alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: usb-audio: Apply async workaround for Scarlett 2i4 2nd gen
Date: Mon, 27 Apr 2020 09:08:37 +0200 [thread overview]
Message-ID: <s5hy2qhpfre.wl-tiwai@suse.de> (raw)
In-Reply-To: <55d78d082f97aa70cb9bb0b90c7a48b8de72f9c5.camel@tsoy.me>
On Sun, 26 Apr 2020 19:12:41 +0200,
Alexander Tsoy wrote:
>
> В Чт, 23/04/2020 в 21:24 +0300, Alexander Tsoy пишет:
> > В Чт, 23/04/2020 в 19:35 +0200, Takashi Iwai пишет:
> > > On Thu, 23 Apr 2020 19:29:08 +0200,
> > > Takashi Iwai wrote:
> > > > On Thu, 23 Apr 2020 18:57:34 +0200,
> > > > Alexander Tsoy wrote:
> > > > > And some further notes:
> > > > >
> > > > > - I removed locking from snd_usb_endpoint_next_packet_size()
> > > > > and
> > > > > this
> > > > > seems completely fixed an issue with large URBs I reported
> > > > > here:
> > > > >
> > > > > https://bugzilla.kernel.org/show_bug.cgi?id=199327#c28
> > > > >
> > > > > So playing at 96 kHz, driver packs 48 frames per URB and no
> > > > > more
> > > > > audio
> > > > > discontinuities.
> > > >
> > > > Hmm, that's weird.
> > > >
> > > > If removing the lock from snd_usb_endpoint_next_packet_size()
> > > > really
> > > > fixes the problem, it implies the lock contention. But as far as
> > > > I
> > > > see the code performed in this lock isn't conflicting so
> > > > much. The
> > > > URB processing shouldn't happen in parallel for the same EP.
> > >
> > > BTW, one potential racy code I found while looking at the code is
> > > the
> > > list management in queue_pending_output_urbs(). The fix patch is
> > > below.
> >
> > OK, it seems like it was just a luck. I'm still getting clicking
> > artifacts with and without your patch, with and without locking. Will
> > investigate further.
>
> After more testing, it seems that with large URBs the transfer size is
> too large for timer-based scheduling to work correctly in pulseaudio.
> And looks like pulseaudio sometimes fail to adjust tsched watermark or
> something like that. And it is not 100% reproducible.
Aha, that's interesting. Basically that's natural that the timer
scheduling doesn't work reliably for the device buffer management like
USB-audio, but it was enabled on PA because it works in most of
cases.
Takashi
next prev parent reply other threads:[~2020-04-27 7:09 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-21 19:09 [PATCH] ALSA: usb-audio: Apply async workaround for Scarlett 2i4 2nd gen Alexander Tsoy
2020-04-21 19:31 ` Takashi Iwai
2020-04-22 3:57 ` Alexander Tsoy
2020-04-22 18:55 ` Gregor Pintar
2020-04-22 19:26 ` Alexander Tsoy
2020-04-22 20:19 ` Alexander Tsoy
2020-04-22 20:28 ` Takashi Iwai
2020-04-22 23:45 ` Alexander Tsoy
2020-04-23 7:22 ` Takashi Iwai
2020-04-23 11:22 ` Takashi Iwai
2020-04-23 15:10 ` Alexander Tsoy
2020-04-23 16:57 ` Alexander Tsoy
2020-04-23 17:29 ` Takashi Iwai
2020-04-23 17:35 ` Takashi Iwai
2020-04-23 18:24 ` Alexander Tsoy
2020-04-26 17:12 ` Alexander Tsoy
2020-04-27 7:08 ` Takashi Iwai [this message]
2020-04-23 17:32 ` Takashi Iwai
2020-04-23 11:46 ` Gregor Pintar
2020-04-23 14:01 ` Alexander Tsoy
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=s5hy2qhpfre.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alexander@tsoy.me \
--cc=alsa-devel@alsa-project.org \
--cc=grpintar@gmail.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