kernel_optimize_test/sound/pci
Takashi Iwai 5972e974eb ALSA: hda: Reduce udelay() at SKL+ position reporting
[ Upstream commit 46243b85b0ec5d2cee7545e5ce18c015ce91957e ]

The position reporting on Intel Skylake and later chips via
azx_get_pos_skl() contains a udelay(20) call for the capture streams.
A call for this alone doesn't sound too harmful.  However, as the
pointer PCM ops is one of the hottest path in the PCM operations --
especially for the timer-scheduled operations like PulseAudio -- such
a delay hogs CPU usage significantly in the total performance.

The code there was taken from the original code in ASoC SST Skylake
driver blindly.  The udelay() is a workaround for the case where the
reported position is behind the period boundary at the timing
triggered from interrupts; applications often expect that the full
data is available for the whole period when returned (and also that's
the definition of the ALSA PCM period).

OTOH, HD-audio (legacy) driver has already some workarounds for the
delayed position reporting due to its relatively large FIFO, such as
the BDL position adjustment and the delayed period-elapsed call in the
work.  That said, the udelay() is almost superfluous for HD-audio
driver unlike SST, and we can drop the udelay().

Though, the current code doesn't guarantee the full period readiness
as mentioned in the above, but rather it checks the wallclock and
detects the unexpected jump.  That's one missing piece, and the drop
of udelay() needs a bit more sanity checks for the delayed handling.

This patch implements those: the drop of udelay() call in
azx_get_pos_skl() and the more proper check of hwptr in
azx_position_ok().  The latter change is applied only for the case
where the stream is running in the normal mode without
no_period_wakeup flag.  When no_period_wakeup is set, it essentially
ignores the period handling and rather concentrates only on the
current position; which implies that we don't need to care about the
period boundary at all.

Fixes: f87e7f2589 ("ALSA: hda - Improved position reporting on SKL+")
Reported-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210929072934.6809-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-18 14:04:15 +01:00
..
ac97 ALSA: Replace the word "slave" in vmaster API 2020-07-20 10:10:47 +02:00
ali5451
asihpi Merge branch 'for-next' into for-linus 2020-10-12 08:51:00 +02:00
au88x0 ALSA: Replace with fallthrough pseudo keyword in the remaining places 2020-07-09 19:10:43 +02:00
aw2
ca0106 ALSA: ca0106: fix error code handling 2020-08-25 09:27:49 +02:00
cs46xx ALSA: pci: delete repeated words in comments 2020-08-06 09:30:02 +02:00
cs5535audio
ctxfi ALSA: ctxfi: cthw20k2: fix mask on conf to allow 4 bits 2021-03-09 11:11:14 +01:00
echoaudio ALSA: echoaudio: Fix potential Oops in snd_echo_resume() 2020-08-13 11:21:05 +02:00
emu10k1 ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
hda ALSA: hda: Reduce udelay() at SKL+ position reporting 2021-11-18 14:04:15 +01:00
ice1712 ALSA: pci: delete repeated words in comments 2020-08-06 09:30:02 +02:00
korg1212
lola
lx6464es
mixart ALSA: mixart: Fix mutex deadlock 2020-11-19 18:26:30 +01:00
nm256 ALSA: nm256: Replace the words blacklist 2020-07-15 14:31:56 +02:00
oxygen ALSA: pci: delete repeated words in comments 2020-08-06 09:30:02 +02:00
pcxhr
riptide ALSA: riptide: Replace tasklet with threaded irq 2020-09-09 18:34:10 +02:00
rme9652 ALSA: rme9652: don't disable if not enabled 2021-05-19 10:12:53 +02:00
trident
vx222
ymfpci ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
ad1889.c
ad1889.h
ak4531_codec.c
als300.c
als4000.c
atiixp_modem.c
atiixp.c ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
azt3328.c ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
azt3328.h
bt87x.c ALSA: bt87x: Replace the words white/blacklist 2020-07-15 14:31:54 +02:00
cmipci.c
cs4281.c
cs5530.c
ens1370.c
ens1371.c
es1938.c
es1968.c ALSA: es1968: Replace the words white/blacklist 2020-07-15 14:31:55 +02:00
fm801.c
intel8x0.c ALSA: intel8x0: Fix breakage at ac97 clock measurement 2021-07-14 16:55:35 +02:00
intel8x0m.c
Kconfig
maestro3.c
Makefile
rme32.c
rme96.c
sis7019.c
sis7019.h
sonicvibes.c
via82xx_modem.c
via82xx.c ALSA: via82xx: Replace the words whitelist 2020-07-15 14:31:57 +02:00