* [PATCH] ALSA: hda: Clear RIRB status before reading WP
@ 2020-02-06 10:10 Viswanath L
2020-02-06 10:47 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Viswanath L @ 2020-02-06 10:10 UTC (permalink / raw)
To: perex, tiwai, mkumard, jonathanh
Cc: arnd, yung-chuan.liao, baolin.wang, kstewart, Julia.Lawall, tglx,
alsa-devel, linux-kernel, spujar, sharadg, rlokhande, DRAMESH,
atalambedu, Viswanath L
From: Mohan Kumar <mkumard@nvidia.com>
RIRB interrupt status getting cleared after the write pointer is read
causes a race condition, where last response(s) into RIRB may remain
unserviced by IRQ, eventually causing azx_rirb_get_response to fall
back to polling mode. Clearing the RIRB interrupt status ahead of
write pointer access ensures that this condition is avoided.
Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
---
sound/pci/hda/hda_controller.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sound/pci/hda/hda_controller.c b/sound/pci/hda/hda_controller.c
index 9757667..2609e39 100644
--- a/sound/pci/hda/hda_controller.c
+++ b/sound/pci/hda/hda_controller.c
@@ -1110,16 +1110,23 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update))
active = true;
- /* clear rirb int */
status = azx_readb(chip, RIRBSTS);
if (status & RIRB_INT_MASK) {
+ /*
+ * Clearing the interrupt status here ensures that no
+ * interrupt gets masked after the RIRB wp is read in
+ * snd_hdac_bus_update_rirb. This avoids a possible
+ * race condition where codec response in RIRB may
+ * remain unserviced by IRQ, eventually falling back
+ * to polling mode in azx_rirb_get_response.
+ */
+ azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
active = true;
if (status & RIRB_INT_RESPONSE) {
if (chip->driver_caps & AZX_DCAPS_CTX_WORKAROUND)
udelay(80);
snd_hdac_bus_update_rirb(bus);
}
- azx_writeb(chip, RIRBSTS, RIRB_INT_MASK);
}
} while (active && ++repeat < 10);
--
2.7.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: hda: Clear RIRB status before reading WP
2020-02-06 10:10 [PATCH] ALSA: hda: Clear RIRB status before reading WP Viswanath L
@ 2020-02-06 10:47 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2020-02-06 10:47 UTC (permalink / raw)
To: Viswanath L
Cc: perex, tiwai, mkumard, jonathanh, arnd, yung-chuan.liao,
baolin.wang, kstewart, Julia.Lawall, tglx, alsa-devel,
linux-kernel, spujar, sharadg, rlokhande, DRAMESH, atalambedu
On Thu, 06 Feb 2020 11:10:53 +0100,
Viswanath L wrote:
>
> From: Mohan Kumar <mkumard@nvidia.com>
>
> RIRB interrupt status getting cleared after the write pointer is read
> causes a race condition, where last response(s) into RIRB may remain
> unserviced by IRQ, eventually causing azx_rirb_get_response to fall
> back to polling mode. Clearing the RIRB interrupt status ahead of
> write pointer access ensures that this condition is avoided.
>
> Signed-off-by: Mohan Kumar <mkumard@nvidia.com>
> Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Applied, thanks.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-06 10:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 10:10 [PATCH] ALSA: hda: Clear RIRB status before reading WP Viswanath L
2020-02-06 10:47 ` Takashi Iwai
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).