mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 04:31:50 +00:00
a0b224b90b
Distorted audio appears occasionally, affecting either playback or capture and requiring the affected substream to be closed by all applications and re-opened. The best way I have found to reproduce the bug is to use dmix in combination with Chromium, which opens the audio device multiple times in threads. Anecdotally, the problems appear to have increased with faster CPUs. I ruled out 32-bit counter wrapping; it often happens much earlier. Since applying this patch I have not had problems, where previously they would occur several times a day. The patch targets the following issues: * Check for progress using the counter from the hardware, not after it has been truncated to the buffer. This is a clean way to address a possible bug where if a whole ringbuffer advances between interrupts, it goes unnoticed. * Move last_period state from chip to pipe This more logically belongs as part of pipe, and code is reasier to read if it is "counter position last time a period elapsed". Now the code has no references to period count. A period is just when the regular counter crosses a threshold. This increases readability and reduces scope for bugs. * Treat period notification and buffer advance independently: This helps to clarify what is the responsibility of the interrupt handler, and what is pcm_pointer(). Removing shared state between these operations means race conditions are fixed without introducing locks. Synchronisation is only around the read of pipe->dma_counter. There may be cache line contention around "struct audiopipe" but I did not have cause to profile this. Pay attention to be robust where dma_counter wrapping is not a multiple of period_size or buffer_size. This is a revised patch based on feedback from Takashi and Giuliano. Signed-off-by: Mark Hills <mark@xwax.org> Link: https://lore.kernel.org/r/20200708101848.3457-5-mark@xwax.org Signed-off-by: Takashi Iwai <tiwai@suse.de> |
||
---|---|---|
.. | ||
ac97 | ||
ali5451 | ||
asihpi | ||
au88x0 | ||
aw2 | ||
ca0106 | ||
cs46xx | ||
cs5535audio | ||
ctxfi | ||
echoaudio | ||
emu10k1 | ||
hda | ||
ice1712 | ||
korg1212 | ||
lola | ||
lx6464es | ||
mixart | ||
nm256 | ||
oxygen | ||
pcxhr | ||
riptide | ||
rme9652 | ||
trident | ||
vx222 | ||
ymfpci | ||
ad1889.c | ||
ad1889.h | ||
ak4531_codec.c | ||
als300.c | ||
als4000.c | ||
atiixp_modem.c | ||
atiixp.c | ||
azt3328.c | ||
azt3328.h | ||
bt87x.c | ||
cmipci.c | ||
cs4281.c | ||
cs5530.c | ||
ens1370.c | ||
ens1371.c | ||
es1938.c | ||
es1968.c | ||
fm801.c | ||
intel8x0.c | ||
intel8x0m.c | ||
Kconfig | ||
maestro3.c | ||
Makefile | ||
rme32.c | ||
rme96.c | ||
sis7019.c | ||
sis7019.h | ||
sonicvibes.c | ||
via82xx_modem.c | ||
via82xx.c |