All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhen Ni <nizhen@uniontech.com>
To: perex@perex.cz, tiwai@suse.com
Cc: Zhen Ni <nizhen@uniontech.com>,
	alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ASoc: SOF: Fix sof-audio-pci-intel-tgl shutdown timeout during hibernation
Date: Wed,  7 Dec 2022 18:22:29 +0800	[thread overview]
Message-ID: <20221207102229.25962-1-nizhen@uniontech.com> (raw)

On Dell Latitude 3420 Notebook, sof-audio-pci-intel-tgl may fail to shutdown
sporadically during hibernation as following log:

[   43.281110] PM: Image saving done
[   43.281699] PM: hibernation: Wrote 2828852 kbytes in 2.78 seconds(1017.57 MB/s)
[   43.282359] PM: SI
[   43.345156] kvm: exiting hardware virtualization
[   43.345865] auxiliary snd_sof.hda-probes.0: shutdown
[   43.346359] skl_hda_dsp_generic skl_hda_dsp_generic: shutdown
[   43.346849] skl_hda_codec hdmi ehdaudio0D2: shutdown
[   43.398204] snd_hda_codec_realtek ehdaudio0DO: shutdown
[   43.419621] dmic-codec dmic-codec: shutdown
[   43.420194] sof-audio-pci-intel-tgl 0000:00:1f.3: shutdown

Call wait_xxx_timeout() to process the timeout.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
 sound/core/init.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index 5377f94eb211..9bd674d7a0fd 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -574,9 +574,10 @@ void snd_card_disconnect_sync(struct snd_card *card)
 	}
 
 	spin_lock_irq(&card->files_lock);
-	wait_event_lock_irq(card->remove_sleep,
+	wait_event_lock_irq_timeout(card->remove_sleep,
 			    list_empty(&card->files_list),
-			    card->files_lock);
+			    card->files_lock,
+			    msecs_to_jiffies(2000));
 	spin_unlock_irq(&card->files_lock);
 }
 EXPORT_SYMBOL_GPL(snd_card_disconnect_sync);
@@ -659,7 +660,7 @@ int snd_card_free(struct snd_card *card)
 	if (ret)
 		return ret;
 	/* wait, until all devices are ready for the free operation */
-	wait_for_completion(&released);
+	wait_for_completion_timeout(&released, msecs_to_jiffies(2000))
 
 	return 0;
 }
-- 
2.20.1



WARNING: multiple messages have this Message-ID (diff)
From: Zhen Ni <nizhen@uniontech.com>
To: perex@perex.cz, tiwai@suse.com
Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
	Zhen Ni <nizhen@uniontech.com>
Subject: [PATCH] ASoc: SOF: Fix sof-audio-pci-intel-tgl shutdown timeout during hibernation
Date: Wed,  7 Dec 2022 18:22:29 +0800	[thread overview]
Message-ID: <20221207102229.25962-1-nizhen@uniontech.com> (raw)

On Dell Latitude 3420 Notebook, sof-audio-pci-intel-tgl may fail to shutdown
sporadically during hibernation as following log:

[   43.281110] PM: Image saving done
[   43.281699] PM: hibernation: Wrote 2828852 kbytes in 2.78 seconds(1017.57 MB/s)
[   43.282359] PM: SI
[   43.345156] kvm: exiting hardware virtualization
[   43.345865] auxiliary snd_sof.hda-probes.0: shutdown
[   43.346359] skl_hda_dsp_generic skl_hda_dsp_generic: shutdown
[   43.346849] skl_hda_codec hdmi ehdaudio0D2: shutdown
[   43.398204] snd_hda_codec_realtek ehdaudio0DO: shutdown
[   43.419621] dmic-codec dmic-codec: shutdown
[   43.420194] sof-audio-pci-intel-tgl 0000:00:1f.3: shutdown

Call wait_xxx_timeout() to process the timeout.

Signed-off-by: Zhen Ni <nizhen@uniontech.com>
---
 sound/core/init.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/sound/core/init.c b/sound/core/init.c
index 5377f94eb211..9bd674d7a0fd 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -574,9 +574,10 @@ void snd_card_disconnect_sync(struct snd_card *card)
 	}
 
 	spin_lock_irq(&card->files_lock);
-	wait_event_lock_irq(card->remove_sleep,
+	wait_event_lock_irq_timeout(card->remove_sleep,
 			    list_empty(&card->files_list),
-			    card->files_lock);
+			    card->files_lock,
+			    msecs_to_jiffies(2000));
 	spin_unlock_irq(&card->files_lock);
 }
 EXPORT_SYMBOL_GPL(snd_card_disconnect_sync);
@@ -659,7 +660,7 @@ int snd_card_free(struct snd_card *card)
 	if (ret)
 		return ret;
 	/* wait, until all devices are ready for the free operation */
-	wait_for_completion(&released);
+	wait_for_completion_timeout(&released, msecs_to_jiffies(2000))
 
 	return 0;
 }
-- 
2.20.1



             reply	other threads:[~2022-12-07 10:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-07 10:22 Zhen Ni [this message]
2022-12-07 10:22 ` [PATCH] ASoc: SOF: Fix sof-audio-pci-intel-tgl shutdown timeout during hibernation Zhen Ni
2022-12-07 10:32 ` Takashi Iwai
2022-12-07 10:32   ` Takashi Iwai
2022-12-07 12:55   ` Kai Vehmanen
2022-12-07 12:55     ` Kai Vehmanen
2022-12-07 16:21 ` kernel test robot
2022-12-07 16:21   ` kernel test robot
2022-12-07 16:31 ` kernel test robot
2022-12-07 16:31   ` kernel test robot

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=20221207102229.25962-1-nizhen@uniontech.com \
    --to=nizhen@uniontech.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.