Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Cezary Rojewski <cezary.rojewski@intel.com>
To: broonie@kernel.org
Cc: tiwai@suse.com, perex@perex.cz,
	amadeuszx.slawinski@linux.intel.com, linux-sound@vger.kernel.org,
	Cezary Rojewski <cezary.rojewski@intel.com>
Subject: [PATCH 2/9] ASoC: Intel: avs: Fix deadlock when the failing IPC is SET_D0IX
Date: Fri, 30 May 2025 16:10:18 +0200	[thread overview]
Message-ID: <20250530141025.2942936-3-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20250530141025.2942936-1-cezary.rojewski@intel.com>

The procedure handling IPC timeouts and EXCEPTION_CAUGHT notification
shall cancel any D0IX work before proceeding with DSP recovery. If
SET_D0IX called from delayed_work is the failing IPC the procedure will
deadlock. Conditionally skip cancelling the work to fix that.

Fixes: 335c4cbd201d ("ASoC: Intel: avs: D0ix power state support")
Reviewed-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
 sound/soc/intel/avs/ipc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c
index 08ed9d96738a..0314f9d4ea5f 100644
--- a/sound/soc/intel/avs/ipc.c
+++ b/sound/soc/intel/avs/ipc.c
@@ -169,7 +169,9 @@ static void avs_dsp_exception_caught(struct avs_dev *adev, union avs_notify_msg
 
 	dev_crit(adev->dev, "communication severed, rebooting dsp..\n");
 
-	cancel_delayed_work_sync(&ipc->d0ix_work);
+	/* 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);
 	ipc->in_d0ix = false;
 	/* Re-enabled on recovery completion. */
 	pm_runtime_disable(adev->dev);
-- 
2.25.1


  parent reply	other threads:[~2025-05-30 13:53 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-30 14:10 [PATCH 0/9] ASoC: Intel: avs: Set of functional fixes Cezary Rojewski
2025-05-30 14:10 ` [PATCH 1/9] ASoC: codecs: hda: Fix RPM usage count underflow Cezary Rojewski
2025-05-30 14:10 ` Cezary Rojewski [this message]
2025-05-30 14:10 ` [PATCH 3/9] ASoC: Intel: avs: Fix PPLCxFMT calculation Cezary Rojewski
2025-05-30 14:10 ` [PATCH 4/9] ASoC: Intel: avs: Fix possible null-ptr-deref when initing hw Cezary Rojewski
2025-05-30 14:10 ` [PATCH 5/9] ASoC: Intel: avs: Fix paths in MODULE_FIRMWARE hints Cezary Rojewski
2025-05-30 14:10 ` [PATCH 6/9] ASoC: Intel: avs: Verify kcalloc() status when setting constraints Cezary Rojewski
2025-05-30 14:10 ` [PATCH 7/9] ASoC: Intel: avs: Verify content returned by parse_int_array() Cezary Rojewski
2025-05-30 14:10 ` [PATCH 8/9] ASoC: Intel: avs: Simplify verification of parse_int_array() result Cezary Rojewski
2025-05-30 14:10 ` [PATCH 9/9] ASoC: Intel: avs: Include missing string.h Cezary Rojewski
2025-06-02 16:42 ` (subset) [PATCH 0/9] ASoC: Intel: avs: Set of functional fixes Mark Brown
2025-06-03 10:57   ` Cezary Rojewski
2025-06-03 11:01     ` Mark Brown
2025-06-03 11:03       ` Cezary Rojewski
2025-06-03 16:04 ` 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=20250530141025.2942936-3-cezary.rojewski@intel.com \
    --to=cezary.rojewski@intel.com \
    --cc=amadeuszx.slawinski@linux.intel.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox