alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Jonas Witschel <diabonas@gmx.de>, alsa-devel@alsa-project.org
Subject: Re: [alsa-devel] [PATCH] Revert "ALSA: hda: Flush interrupts on disabling"
Date: Mon, 28 Oct 2019 12:09:16 +0100	[thread overview]
Message-ID: <s5h1ruxt9cz.wl-tiwai@suse.de> (raw)
In-Reply-To: <s5h8sp5mg67.wl-tiwai@suse.de>

On Mon, 28 Oct 2019 09:24:00 +0100,
Takashi Iwai wrote:
> 
> On Mon, 28 Oct 2019 09:21:07 +0100,
> Chris Wilson wrote:
> > 
> > Quoting Takashi Iwai (2019-10-28 08:10:56)
> > > 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.
> 
> 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.
> 
> > 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 <tiwai@suse.de>
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 <chris@chris-wilson.co.uk>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_bind.c  | 4 ++++
 sound/pci/hda/hda_intel.c | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
index 8272b50b8349..6a8564566375 100644
--- a/sound/pci/hda/hda_bind.c
+++ b/sound/pci/hda/hda_bind.c
@@ -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);
 }
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index cf53fbd872ee..7304a92559a3 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -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;
 }
 
-- 
2.16.4

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

      reply	other threads:[~2019-10-28 11:10 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-28  8:10 [alsa-devel] [PATCH] Revert "ALSA: hda: Flush interrupts on disabling" Takashi Iwai
2019-10-28  8:21 ` Chris Wilson
2019-10-28  8:24   ` Takashi Iwai
2019-10-28 11:09     ` Takashi Iwai [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5h1ruxt9cz.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=diabonas@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).