Skip to contentSkip to conversation

Revert "ALSA: hda: Flush interrupts on disabling"

PATCH In review Takashi Iwai 2 participants 4 messages Oct 28, 2019 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Revert "ALSA: hda: Flush interrupts on disabling"

This reverts commit caa8422d01e983782548648e125fd617cadcec3f.

It turned out that this commit caused a regression at shutdown / reboot, as the synchronize_irq() calls seems blocking the whole shutdown. Also another part of the change about shuffling the call order looks suspicious; the azx_stop_chip() call disables the CORB / RIRB while the others may still need the CORB/RIRB update.

Since the original commit itself was a cargo-fix, let's revert the whole patch.

---
 sound/hda/hdac_controller.c | 2 --
 sound/pci/hda/hda_intel.c   | 2 +-
 2 files changed, 1 insertion(+), 3 deletions(-)
sound/hda/hdac_controller.c +0 -2
index d3999e7b0705..7e7be8e4dcf9 100644
@@ -447,8 +447,6 @@ static void azx_int_disable(struct hdac_bus *bus)
 	list_for_each_entry(azx_dev, &bus->stream_list, list)
 		snd_hdac_stream_updateb(azx_dev, SD_CTL, SD_INT_MASK, 0);
 
-	synchronize_irq(bus->irq);
-
 	/* disable SIE for all streams */
 	snd_hdac_chip_writeb(bus, INTCTL, 0);
 
sound/pci/hda/hda_intel.c +1 -1
index a815bc811799..cf53fbd872ee 100644
@@ -1348,9 +1348,9 @@ static int azx_free(struct azx *chip)
 	}
 
 	if (bus->chip_init) {
-		azx_stop_chip(chip);
 		azx_clear_irq_pending(chip);
 		azx_stop_all_streams(chip);
+		azx_stop_chip(chip);
 	}
 
 	if (bus->irq >= 0)
Signature · 6 lines
2.16.4

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#1 lore raw

Quoting Takashi Iwai (2019-10-28 08:10:56)

Quoted 10 lines

This reverts commit caa8422d01e983782548648e125fd617cadcec3f.

It turned out that this commit caused a regression at shutdown / reboot, as the synchronize_irq() calls seems blocking the whole shutdown. Also another part of the change about shuffling the call order looks suspicious; the azx_stop_chip() call disables the CORB / RIRB while the others may still need the CORB/RIRB update.

Since the original commit itself was a cargo-fix, let's revert the whole patch.

You will want to include a link to the bug you may be reintroducing so you have that information for easy reference later.

Also do you know if you fixed the bug in any other way, because our CI hasn't reported that GPF since the patch landed.
-Chris
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#2 lore raw
Quoted 10 lines · Chris Wilson

Quoting Takashi Iwai (2019-10-28 08:10:56)

Quoted 8 lines

This reverts commit caa8422d01e983782548648e125fd617cadcec3f.

It turned out that this commit caused a regression at shutdown / reboot, as the synchronize_irq() calls seems blocking the whole shutdown. Also another part of the change about shuffling the call order looks suspicious; the azx_stop_chip() call disables the CORB / RIRB while the others may still need the CORB/RIRB update.

Quoted 5 lines
Quoted 2 lines

Since the original commit itself was a cargo-fix, let's revert the whole patch.

You will want to include a link to the bug you may be reintroducing so you have that information for easy reference later.

Actually I forgot to put the Fixes tag where usually you can track the original issue from there. Will fix it. I don't mind to put yet another bug link tag, though.

Quoted 2 lines

Also do you know if you fixed the bug in any other way, because our CI hasn't reported that GPF since the patch landed.

Well, let's see whether the GPF reappears with the revert at first. It might be another fix that covered.

thanks,

Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#3 lore raw
Quoted 23 lines · Takashi Iwai
Quoted 10 lines · Chris Wilson

Quoting Takashi Iwai (2019-10-28 08:10:56)

Quoted 8 lines

This reverts commit caa8422d01e983782548648e125fd617cadcec3f.

It turned out that this commit caused a regression at shutdown / reboot, as the synchronize_irq() calls seems blocking the whole shutdown. Also another part of the change about shuffling the call order looks suspicious; the azx_stop_chip() call disables the CORB / RIRB while the others may still need the CORB/RIRB update.

Quoted 5 lines
Quoted 2 lines

Since the original commit itself was a cargo-fix, let's revert the whole patch.

You will want to include a link to the bug you may be reintroducing so you have that information for easy reference later.

Actually I forgot to put the Fixes tag where usually you can track the original issue from there. Will fix it. I don't mind to put yet another bug link tag, though.

Quoted 5 lines
Quoted 2 lines

Also do you know if you fixed the bug in any other way, because our CI hasn't reported that GPF since the patch landed.

Well, let's see whether the GPF reappears with the revert at first. It might be another fix that covered.

Thinking over this again, the patch below should cover this kind of races (hopefully). I'm going to queue this together with the revert.

thanks,

Takashi

-- 8< --
From: Takashi Iwai <[email protected]>
Subject: [PATCH] ALSA: hda - Fix pending unsol events at shutdown

This is an alternative fix attemp for the issue reported in the commit caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling") that was reverted later due to regressions. Instead of tweaking the hardware disablement order and the enforced irq flushing, do calling cancel_work_sync() of the unsol work early enough, and explicitly ignore the unsol events during the shutdown by checking the bus->shutdown flag.

Fixes caa8422d01e9 ("ALSA: hda: Flush interrupts on disabling")
Cc Chris Wilson <[email protected]>
---
 sound/pci/hda/hda_bind.c  | 4 ++++
 sound/pci/hda/hda_intel.c | 3 +++
 2 files changed, 7 insertions(+)
sound/pci/hda/hda_bind.c +4 -0
index 8272b50b8349..6a8564566375 100644
@@ -43,6 +43,10 @@ static void hda_codec_unsol_event(struct hdac_device *dev, unsigned int ev)
 {
 	struct hda_codec *codec = container_of(dev, struct hda_codec, core);
 
+	/* ignore unsol events during shutdown */
+	if (codec->bus->shutdown)
+		return;
+
 	if (codec->patch_ops.unsol_event)
 		codec->patch_ops.unsol_event(codec, ev);
 }
sound/pci/hda/hda_intel.c +3 -0
index cf53fbd872ee..7304a92559a3 100644
@@ -1382,8 +1382,11 @@ static int azx_free(struct azx *chip)
 static int azx_dev_disconnect(struct snd_device *device)
 {
 	struct azx *chip = device->device_data;
+	struct hdac_bus *bus = azx_bus(chip);
 
 	chip->bus.shutdown = 1;
+	cancel_work_sync(&bus->unsol_work);
+
 	return 0;
 }
 
Signature · 6 lines
2.16.4

_______________________________________________
Alsa-devel mailing list
[email protected]
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel