All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: tiwai@suse.com, perex@perex.cz, amade@asmblr.net,
	linux-sound@vger.kernel.org,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH v4 07/10] ASoC: Intel: avs: Cancel d0ix_work asynchrounously during recovery
Date: Wed,  2 Sep 2026 10:18:11 +0200	[thread overview]
Message-ID: <20260902081814.1590883-8-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20260902081814.1590883-1-cezary.rojewski@intel.com>

Tests with corrupted firmware binaries prove that the recovery procedure
can hit deadlock with d0ix_work if the work has been scheduled shortly
before the event that triggered the recovery e.g.: timeouts on
communication with a dead AudioDSP firmware.

At the same time, the ready-check shall be done after acquiring the
msg_mutex as the flag might have been modified by the time the lock is
granted. The recovery case is one of such examples.

Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/ipc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c
index 39b0de9831da..5010b0f5be47 100644
--- a/sound/soc/intel/avs/ipc.c
+++ b/sound/soc/intel/avs/ipc.c
@@ -172,7 +172,7 @@ static void avs_dsp_exception_caught(struct avs_dev *adev, union avs_notify_msg
 
 	/* Avoid deadlock as the exception may be the response to SET_D0IX. */
 	if (current_work() != &ipc->d0ix_work.work)
-		cancel_delayed_work_sync(&ipc->d0ix_work);
+		cancel_delayed_work(&ipc->d0ix_work);
 	ipc->in_d0ix = false;
 	/* Re-enabled on recovery completion. */
 	pm_runtime_disable(adev->dev);
@@ -395,11 +395,11 @@ static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request
 	struct avs_ipc *ipc = adev->ipc;
 	int ret;
 
+	guard(mutex)(&ipc->msg_mutex);
+
 	if (!ipc->ready)
 		return -EPERM;
 
-	guard(mutex)(&ipc->msg_mutex);
-
 	spin_lock(&ipc->rx_lock);
 	avs_ipc_msg_init(ipc, reply);
 	avs_dsp_send_tx(adev, request, true);
-- 
2.34.1


  parent reply	other threads:[~2026-09-02  8:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02  8:18 [PATCH v4 00/10] ALSA/ASoC: Intel: avs: HDAudio bus and general fixes Cezary Rojewski
2026-09-02  8:18 ` [PATCH v4 01/10] ALSA: hda: ext: Clean up links if their initialization fails Cezary Rojewski
2026-09-02 13:43   ` Takashi Iwai
2026-09-02  8:18 ` [PATCH v4 02/10] ALSA: hda: ext: Clean up streams " Cezary Rojewski
2026-09-02 13:43   ` Takashi Iwai
2026-09-02  8:18 ` [PATCH v4 03/10] ASoC: Intel: avs: Clean up the bus when its " Cezary Rojewski
2026-09-02  8:18 ` [PATCH v4 04/10] ASoC: Intel: avs: Clean up the bus when fetching ML caps fails Cezary Rojewski
2026-09-02  8:18 ` [PATCH v4 05/10] ASoC: Intel: avs: Clean up streams if their initialization fails Cezary Rojewski
2026-09-02  8:18 ` [PATCH v4 06/10] ASoC: Intel: avs: Do not ignore -ENOENT when loading a topology Cezary Rojewski
2026-09-02  8:18 ` Cezary Rojewski [this message]
2026-09-02  8:18 ` [PATCH v4 08/10] ASoC: Intel: avs: Fix unbalanced module reference count Cezary Rojewski
2026-09-02  8:18 ` [PATCH v4 09/10] ASoC: Intel: avs: Refactor and fix init_config access Cezary Rojewski
2026-09-02  8:18 ` [PATCH v4 10/10] ASoC: Intel: avs: hda: Constrain MSBs on startup Cezary Rojewski
2026-09-03 21:53 ` [PATCH v4 00/10] ALSA/ASoC: Intel: avs: HDAudio bus and general fixes Mark Brown

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=20260902081814.1590883-8-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amade@asmblr.net \
    --cc=broonie@kernel.org \
    --cc=linux-sound@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.