Skip to contentSkip to conversation

ALSA: hda/core: Log stream DMA errors on interrupt

PATCH In review Arun Raghavan 4 participants 9 messages Aug 3 – Nov 16

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ALSA: hda/core: Log stream DMA errors on interrupt

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

---
 sound/hda/core/controller.c | 5 +++++
 1 file changed, 5 insertions(+)
sound/hda/core/controller.c +5 -0
index 69e11d62bbfa..5f1d2c132cec 100644
@@ -682,6 +682,11 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 			sd_status = snd_hdac_stream_readb(azx_dev, SD_STS);
 			snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK);
 			handled |= 1 << azx_dev->index;
+			if (sd_status & (SD_INT_FIFO_ERR | SD_INT_DESC_ERR)) {
+				dev_warn_ratelimited(bus->dev,
+						"stream %u dma error: 0x%02x\n",
+						azx_dev->index, sd_status);
+			}
 			if ((!azx_dev->substream && !azx_dev->cstream) ||
 			    !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
 				continue;

---
base-commit: 848acc8ffe1b7cd5f1bf427b93069becfebc2c9d
change-id: 20260803-master-48a36c6e70e0

Best regards,

Signature · 1 line
Arun Raghavan <[email protected]>
#1 lore raw
Quoted 11 lines · Arun Raghavan

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

Applied now to for-next branch.

It's interesting at which situation you get the error bit and which one. If it can be used *reliably* for catching a streaming error, the driver could notify XRUN or error appropriately, too.

thanks,

Takashi

#2 lore raw
Quoted 11 lines · Takashi Iwai
Quoted 9 lines · Arun Raghavan

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

Quoted 8 lines
Quoted 2 lines

Applied now to for-next branch.

It's interesting at which situation you get the error bit and which one. If it can be used *reliably* for catching a streaming error, the driver could notify XRUN or error appropriately, too.

Ah, I should have mentioned that in the commit message. The error bit that was signalled was SD_INT_FIFO_ERR -- the status byte was read as (SD_STS_FIFO_READY | SD_INT_FIFO_ERR).

We are still working on pinning down the precise cause in this case, but it seems to be related to issues in some specific setups during lower frequency memory clock transitions. The error manifests as a short dropout caused by what appears to be a stall or missed transfer. The frequency of dropouts varies from several per minute to one every few minutes.

In such a case, the existence of XRUNs might be good to know further up the stack, though it isn't clear that there is much that userspace can autonomously do to mitigate the it.

Cheers,
Arun

#3 lore raw
Quoted 33 lines · Arun Raghavan
Quoted 11 lines · Takashi Iwai
Quoted 9 lines · Arun Raghavan

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

Quoted 8 lines
Quoted 2 lines

Applied now to for-next branch.

It's interesting at which situation you get the error bit and which one. If it can be used *reliably* for catching a streaming error, the driver could notify XRUN or error appropriately, too.

Ah, I should have mentioned that in the commit message. The error bit that was signalled was SD_INT_FIFO_ERR -- the status byte was read as (SD_STS_FIFO_READY | SD_INT_FIFO_ERR).

We are still working on pinning down the precise cause in this case, but it seems to be related to issues in some specific setups during lower frequency memory clock transitions. The error manifests as a short dropout caused by what appears to be a stall or missed transfer. The frequency of dropouts varies from several per minute to one every few minutes.

Quoted 3 lines

In such a case, the existence of XRUNs might be good to know further up the stack, though it isn't clear that there is much that userspace can autonomously do to mitigate the it.

When we do stop the stream as XRUN and notifies to user-space, usually it tries to recover / restart -- something like below.

But it's hard to judge whether we should do this, or it can lead rather to misbehavior. We need experiments.

thanks,

Takashi

-- 8< --

include/sound/hdaudio.h +3 -1
index aa994d6e6d35..615e48ecb009 100644
@@ -412,7 +412,9 @@ void snd_hdac_bus_link_power(struct hdac_device *hdev, bool enable);
 void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *));
+						struct hdac_stream *),
+				    void (*error)(struct hdac_bus *,
+						  struct hdac_stream *));
 
 int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
 void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
sound/hda/common/controller.c +11 -1
index afec5c5546ec..329854c9fe92 100644
@@ -1058,6 +1058,15 @@ static void stream_update(struct hdac_bus *bus, struct hdac_stream *s)
 	}
 }
 
+static void stream_error(struct hdac_bus *bus, struct hdac_stream *s)
+{
+	struct azx_dev *azx_dev = stream_to_azx_dev(s);
+
+	spin_unlock(&bus->reg_lock);
+	snd_pcm_stop_xrun(azx_stream(azx_dev)->substream);
+	spin_lock(&bus->reg_lock);
+}
+
 irqreturn_t azx_interrupt(int irq, void *dev_id)
 {
 	struct azx *chip = dev_id;
@@ -1082,7 +1091,8 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
 
 		handled = true;
 		active = false;
-		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update))
+		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update,
+						   stream_error))
 			active = true;
 
 		status = azx_readb(chip, RIRBSTS);
sound/hda/core/controller.c +6 -2
index 78855ac357c6..67bb74c618bf 100644
@@ -676,8 +676,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_stop_chip);
  * Returns the bits of handled streams, or zero if no stream is handled.
  */
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
-				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *))
+				   void (*ack)(struct hdac_bus *,
+					       struct hdac_stream *),
+				   void (*error)(struct hdac_bus *,
+						 struct hdac_stream *))
 {
 	struct hdac_stream *azx_dev;
 	u8 sd_status;
@@ -692,6 +694,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				dev_warn_ratelimited(bus->dev,
 						"stream %u dma error: 0x%02x\n",
 						azx_dev->index, sd_status);
+				if (error)
+					error(bus, azx_dev);
 			}
 			if ((!azx_dev->substream && !azx_dev->cstream) ||
 			    !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
sound/soc/intel/avs/core.c +2 -1
index 1a53856c2ffb..6a5a6e526c2c 100644
@@ -270,7 +270,8 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
 	u32 status;
 
 	status = snd_hdac_chip_readl(bus, INTSTS);
-	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream))
+	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream,
+					   NULL))
 		ret = IRQ_HANDLED;
 
 	spin_lock_irq(&bus->reg_lock);
#4 lore raw
Quoted 127 lines · Takashi Iwai
Quoted 33 lines · Arun Raghavan
Quoted 11 lines · Takashi Iwai
Quoted 9 lines · Arun Raghavan

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

Quoted 8 lines
Quoted 2 lines

Applied now to for-next branch.

It's interesting at which situation you get the error bit and which one. If it can be used *reliably* for catching a streaming error, the driver could notify XRUN or error appropriately, too.

Ah, I should have mentioned that in the commit message. The error bit that was signalled was SD_INT_FIFO_ERR -- the status byte was read as (SD_STS_FIFO_READY | SD_INT_FIFO_ERR).

We are still working on pinning down the precise cause in this case, but it seems to be related to issues in some specific setups during lower frequency memory clock transitions. The error manifests as a short dropout caused by what appears to be a stall or missed transfer. The frequency of dropouts varies from several per minute to one every few minutes.

Quoted 3 lines

In such a case, the existence of XRUNs might be good to know further up the stack, though it isn't clear that there is much that userspace can autonomously do to mitigate the it.

When we do stop the stream as XRUN and notifies to user-space, usually it tries to recover / restart -- something like below.

But it's hard to judge whether we should do this, or it can lead rather to misbehavior. We need experiments.

thanks,

Takashi

-- 8< --

include/sound/hdaudio.h +3 -1
index aa994d6e6d35..615e48ecb009 100644
@@ -412,7 +412,9 @@ void snd_hdac_bus_link_power(struct hdac_device *hdev, bool enable);
 void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *));
+						struct hdac_stream *),
+				    void (*error)(struct hdac_bus *,
+						  struct hdac_stream *));
 
 int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
 void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
sound/hda/common/controller.c +11 -1
index afec5c5546ec..329854c9fe92 100644
@@ -1058,6 +1058,15 @@ static void stream_update(struct hdac_bus *bus, struct hdac_stream *s)
 	}
 }
 
+static void stream_error(struct hdac_bus *bus, struct hdac_stream *s)
+{
+	struct azx_dev *azx_dev = stream_to_azx_dev(s);
+
+	spin_unlock(&bus->reg_lock);
+	snd_pcm_stop_xrun(azx_stream(azx_dev)->substream);
+	spin_lock(&bus->reg_lock);
+}
+
 irqreturn_t azx_interrupt(int irq, void *dev_id)
 {
 	struct azx *chip = dev_id;
@@ -1082,7 +1091,8 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
 
 		handled = true;
 		active = false;
-		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update))
+		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update,
+						   stream_error))
 			active = true;
 
 		status = azx_readb(chip, RIRBSTS);
sound/hda/core/controller.c +6 -2
index 78855ac357c6..67bb74c618bf 100644
@@ -676,8 +676,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_stop_chip);
  * Returns the bits of handled streams, or zero if no stream is handled.
  */
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
-				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *))
+				   void (*ack)(struct hdac_bus *,
+					       struct hdac_stream *),
+				   void (*error)(struct hdac_bus *,
+						 struct hdac_stream *))
 {
 	struct hdac_stream *azx_dev;
 	u8 sd_status;
@@ -692,6 +694,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				dev_warn_ratelimited(bus->dev,
 						"stream %u dma error: 0x%02x\n",
 						azx_dev->index, sd_status);
+				if (error)
+					error(bus, azx_dev);
 			}
 			if ((!azx_dev->substream && !azx_dev->cstream) ||
 			    !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
sound/soc/intel/avs/core.c +0 -0
index 1a53856c2ffb..6a5a6e526c2c 100644

sound/soc/intel/avs/core.c static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus) · line 277

Quoted 9 lines
sound/soc/intel/avs/core.c +2 -1
@@ -270,7 +270,8 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
 	u32 status;
 
 	status = snd_hdac_chip_readl(bus, INTSTS);
-	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream))
+	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream,
+					   NULL))
 		ret = IRQ_HANDLED;
 
 	spin_lock_irq(&bus->reg_lock);

This did work to surface the errors to userspace as XRUNs.

Of course, because this is an actual error in the transfer between the CPU and controller, it does not help mitigate the actual problem itself.

Thanks!
Arun

#5 lore raw
Quoted 137 lines · Arun Raghavan
Quoted 135 lines · Takashi Iwai
Quoted 33 lines · Arun Raghavan
Quoted 11 lines · Takashi Iwai
Quoted 9 lines · Arun Raghavan

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

Quoted 8 lines
Quoted 2 lines

Applied now to for-next branch.

It's interesting at which situation you get the error bit and which one. If it can be used *reliably* for catching a streaming error, the driver could notify XRUN or error appropriately, too.

Ah, I should have mentioned that in the commit message. The error bit that was signalled was SD_INT_FIFO_ERR -- the status byte was read as (SD_STS_FIFO_READY | SD_INT_FIFO_ERR).

We are still working on pinning down the precise cause in this case, but it seems to be related to issues in some specific setups during lower frequency memory clock transitions. The error manifests as a short dropout caused by what appears to be a stall or missed transfer. The frequency of dropouts varies from several per minute to one every few minutes.

Quoted 3 lines

In such a case, the existence of XRUNs might be good to know further up the stack, though it isn't clear that there is much that userspace can autonomously do to mitigate the it.

When we do stop the stream as XRUN and notifies to user-space, usually it tries to recover / restart -- something like below.

But it's hard to judge whether we should do this, or it can lead rather to misbehavior. We need experiments.

thanks,

Takashi

-- 8< --

include/sound/hdaudio.h +3 -1
index aa994d6e6d35..615e48ecb009 100644
@@ -412,7 +412,9 @@ void snd_hdac_bus_link_power(struct hdac_device *hdev, bool enable);
 void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *));
+						struct hdac_stream *),
+				    void (*error)(struct hdac_bus *,
+						  struct hdac_stream *));
 
 int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
 void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
sound/hda/common/controller.c +11 -1
index afec5c5546ec..329854c9fe92 100644
@@ -1058,6 +1058,15 @@ static void stream_update(struct hdac_bus *bus, struct hdac_stream *s)
 	}
 }
 
+static void stream_error(struct hdac_bus *bus, struct hdac_stream *s)
+{
+	struct azx_dev *azx_dev = stream_to_azx_dev(s);
+
+	spin_unlock(&bus->reg_lock);
+	snd_pcm_stop_xrun(azx_stream(azx_dev)->substream);
+	spin_lock(&bus->reg_lock);
+}
+
 irqreturn_t azx_interrupt(int irq, void *dev_id)
 {
 	struct azx *chip = dev_id;
@@ -1082,7 +1091,8 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
 
 		handled = true;
 		active = false;
-		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update))
+		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update,
+						   stream_error))
 			active = true;
 
 		status = azx_readb(chip, RIRBSTS);
sound/hda/core/controller.c +6 -2
index 78855ac357c6..67bb74c618bf 100644
@@ -676,8 +676,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_stop_chip);
  * Returns the bits of handled streams, or zero if no stream is handled.
  */
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
-				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *))
+				   void (*ack)(struct hdac_bus *,
+					       struct hdac_stream *),
+				   void (*error)(struct hdac_bus *,
+						 struct hdac_stream *))
 {
 	struct hdac_stream *azx_dev;
 	u8 sd_status;
@@ -692,6 +694,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				dev_warn_ratelimited(bus->dev,
 						"stream %u dma error: 0x%02x\n",
 						azx_dev->index, sd_status);
+				if (error)
+					error(bus, azx_dev);
 			}
 			if ((!azx_dev->substream && !azx_dev->cstream) ||
 			    !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
sound/soc/intel/avs/core.c +2 -1
index 1a53856c2ffb..6a5a6e526c2c 100644
@@ -270,7 +270,8 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
 	u32 status;
 
 	status = snd_hdac_chip_readl(bus, INTSTS);
-	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream))
+	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream,
+					   NULL))
 		ret = IRQ_HANDLED;
 
Quoted 6 lines

sound/soc/intel/avs/core.c static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus) · line 277

Quoted 1 line
sound/soc/intel/avs/core.c +0 -0
 	spin_lock_irq(&bus->reg_lock);

This did work to surface the errors to userspace as XRUNs.

Of course, because this is an actual error in the transfer between the CPU and controller, it does not help mitigate the actual problem itself.

So what's the best option for users if this happens?
That is, what happens if we don't restart the stream? Is it a temporary fail-out and the hardware recovers / resync by itself while streaming further? If so and it's short, it might be better to leave it as is. OTOH, if it's a fatal error that needs some manual recovery, a notification to user-space for recovery is required (if any).

thanks,

Takashi

#6 lore raw
Quoted 146 lines · Takashi Iwai
Quoted 137 lines · Arun Raghavan
Quoted 135 lines · Takashi Iwai
Quoted 33 lines · Arun Raghavan
Quoted 11 lines · Takashi Iwai
Quoted 9 lines · Arun Raghavan

The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches.

Observed on some AMD GPU HDMI audio controllers under specific low power circumstances.

Quoted 8 lines
Quoted 2 lines

Applied now to for-next branch.

It's interesting at which situation you get the error bit and which one. If it can be used *reliably* for catching a streaming error, the driver could notify XRUN or error appropriately, too.

Ah, I should have mentioned that in the commit message. The error bit that was signalled was SD_INT_FIFO_ERR -- the status byte was read as (SD_STS_FIFO_READY | SD_INT_FIFO_ERR).

We are still working on pinning down the precise cause in this case, but it seems to be related to issues in some specific setups during lower frequency memory clock transitions. The error manifests as a short dropout caused by what appears to be a stall or missed transfer. The frequency of dropouts varies from several per minute to one every few minutes.

Quoted 3 lines

In such a case, the existence of XRUNs might be good to know further up the stack, though it isn't clear that there is much that userspace can autonomously do to mitigate the it.

When we do stop the stream as XRUN and notifies to user-space, usually it tries to recover / restart -- something like below.

But it's hard to judge whether we should do this, or it can lead rather to misbehavior. We need experiments.

thanks,

Takashi

-- 8< --

include/sound/hdaudio.h +3 -1
index aa994d6e6d35..615e48ecb009 100644
@@ -412,7 +412,9 @@ void snd_hdac_bus_link_power(struct hdac_device *hdev, bool enable);
 void snd_hdac_bus_update_rirb(struct hdac_bus *bus);
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *));
+						struct hdac_stream *),
+				    void (*error)(struct hdac_bus *,
+						  struct hdac_stream *));
 
 int snd_hdac_bus_alloc_stream_pages(struct hdac_bus *bus);
 void snd_hdac_bus_free_stream_pages(struct hdac_bus *bus);
sound/hda/common/controller.c +11 -1
index afec5c5546ec..329854c9fe92 100644
@@ -1058,6 +1058,15 @@ static void stream_update(struct hdac_bus *bus, struct hdac_stream *s)
 	}
 }
 
+static void stream_error(struct hdac_bus *bus, struct hdac_stream *s)
+{
+	struct azx_dev *azx_dev = stream_to_azx_dev(s);
+
+	spin_unlock(&bus->reg_lock);
+	snd_pcm_stop_xrun(azx_stream(azx_dev)->substream);
+	spin_lock(&bus->reg_lock);
+}
+
 irqreturn_t azx_interrupt(int irq, void *dev_id)
 {
 	struct azx *chip = dev_id;
@@ -1082,7 +1091,8 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
 
 		handled = true;
 		active = false;
-		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update))
+		if (snd_hdac_bus_handle_stream_irq(bus, status, stream_update,
+						   stream_error))
 			active = true;
 
 		status = azx_readb(chip, RIRBSTS);
sound/hda/core/controller.c +6 -2
index 78855ac357c6..67bb74c618bf 100644
@@ -676,8 +676,10 @@ EXPORT_SYMBOL_GPL(snd_hdac_bus_stop_chip);
  * Returns the bits of handled streams, or zero if no stream is handled.
  */
 int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
-				    void (*ack)(struct hdac_bus *,
-						struct hdac_stream *))
+				   void (*ack)(struct hdac_bus *,
+					       struct hdac_stream *),
+				   void (*error)(struct hdac_bus *,
+						 struct hdac_stream *))
 {
 	struct hdac_stream *azx_dev;
 	u8 sd_status;
@@ -692,6 +694,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
 				dev_warn_ratelimited(bus->dev,
 						"stream %u dma error: 0x%02x\n",
 						azx_dev->index, sd_status);
+				if (error)
+					error(bus, azx_dev);
 			}
 			if ((!azx_dev->substream && !azx_dev->cstream) ||
 			    !azx_dev->running || !(sd_status & SD_INT_COMPLETE))
sound/soc/intel/avs/core.c +2 -1
index 1a53856c2ffb..6a5a6e526c2c 100644
@@ -270,7 +270,8 @@ static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus)
 	u32 status;
 
 	status = snd_hdac_chip_readl(bus, INTSTS);
-	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream))
+	if (snd_hdac_bus_handle_stream_irq(bus, status, hdac_update_stream,
+					   NULL))
 		ret = IRQ_HANDLED;
 
Quoted 6 lines

sound/soc/intel/avs/core.c static irqreturn_t avs_hda_interrupt(struct hdac_bus *bus) · line 277

Quoted 1 line
sound/soc/intel/avs/core.c +0 -0
 	spin_lock_irq(&bus->reg_lock);

This did work to surface the errors to userspace as XRUNs.

Of course, because this is an actual error in the transfer between the CPU and controller, it does not help mitigate the actual problem itself.

Quoted 7 lines

So what's the best option for users if this happens?
That is, what happens if we don't restart the stream? Is it a temporary fail-out and the hardware recovers / resync by itself while streaming further? If so and it's short, it might be better to leave it as is. OTOH, if it's a fatal error that needs some manual recovery, a notification to user-space for recovery is required (if any).

Unfortunately, there doesn't appear to be much users can do in this state. The warnings we have introduced should at least point to a cause, but the issues seem to be around GPU clocks and power management, for example like in this issue:

https://gitlab.freedesktop.org/drm/amd/-/work_items/4517

-- Arun

#7 lore raw
Quoted 10 lines · Arun Raghavan
Quoted 5 lines · Takashi Iwai

So what's the best option for users if this happens?
That is, what happens if we don't restart the stream? Is it a temporary fail-out and the hardware recovers / resync by itself while streaming further? If so and it's short, it might be better to leave it as is.

Unfortunately, there doesn't appear to be much users can do in this state. The warnings we have introduced should at least point to a cause, but the issues seem to be around GPU clocks and power management

A data point from Intel hardware, where there are no obvious issues with playback quality.

7.3.0 logs this continuously as soon as PipeWire opens the analog playback stream:

snd_hda_intel 0000:00:1f.3: stream 7 dma error: 0x28

Per include/sound/hda_register.h, 0x28 is FIFO_READY | FIFO_ERR, the same bits you reported.

The only open PCM is pcm0p (2ch, 48 kHz, period 1024, buffer 32768 frames), so I'm assuming that's stream 7.

Counting the callbacks suppressed, it's something like 7-8/second.

ThinkPad X1 Yoga 3rd gen:
* i7-8650U, Sunrise Point-LP HDA 8086:9d71 subsystem 17aa:2259
* Realtek ALC285
* snd_hda_intel
* no dGPU

If there's some data I can collect let me know.

-- Mike

#8 lore raw
Quoted 26 lines · Michael
Quoted 10 lines · Arun Raghavan
Quoted 5 lines · Takashi Iwai

So what's the best option for users if this happens?
That is, what happens if we don't restart the stream? Is it a temporary fail-out and the hardware recovers / resync by itself while streaming further? If so and it's short, it might be better to leave it as is.

Unfortunately, there doesn't appear to be much users can do in this state. The warnings we have introduced should at least point to a cause, but the issues seem to be around GPU clocks and power management

A data point from Intel hardware, where there are no obvious issues with playback quality.

7.3.0 logs this continuously as soon as PipeWire opens the analog playback stream:

snd_hda_intel 0000:00:1f.3: stream 7 dma error: 0x28

Per include/sound/hda_register.h, 0x28 is FIFO_READY | FIFO_ERR, the same bits you reported.

The only open PCM is pcm0p (2ch, 48 kHz, period 1024, buffer 32768 frames), so I'm assuming that's stream 7.

Quoted 7 lines

Counting the callbacks suppressed, it's something like 7-8/second.

ThinkPad X1 Yoga 3rd gen:
* i7-8650U, Sunrise Point-LP HDA 8086:9d71 subsystem 17aa:2259
* Realtek ALC285
* snd_hda_intel
* no dGPU

Hum, that's not great. I'm not aware of what the Intel hardware might be doing. Maybe Peter (cc'ed) does?

-- Arun