* [PATCH] ALSA: hda: intel: Drop obsolete probe-work unlock workaround
@ 2026-03-28 23:42 Cássio Gabriel
2026-03-29 9:07 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Cássio Gabriel @ 2026-03-28 23:42 UTC (permalink / raw)
To: Takashi Iwai, Jaroslav Kysela
Cc: linux-sound, linux-kernel, Cássio Gabriel
Commit ab949d519601 ("ALSA: hda - Fix deadlock of controller device
lock at unbinding") added a temporary device_unlock()/device_lock()
pair around probe-work cancellation to avoid a deadlock between
controller unbind and codec probe.
That deadlock depended on the driver core taking both a device lock and
its parent lock during bind and unbind. Since commit 8c97a46af04b
("driver core: hold dev's parent lock when needed") and follow-up
fixes, the parent lock is only taken when bus->need_parent_lock is set.
The HDA bus does not set that flag, so codec binding no longer locks
the controller device as the codec's parent.
Keep cancel_delayed_work_sync(), since the async probe/remove race
still needs to be serialized, but drop the stale unlock/relock
workaround and its outdated FIXME comment. Keeping it around only
opens an unnecessary unlocked window inside azx_remove().
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
sound/hda/controllers/intel.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
index 8a7bd49e411f..1b22dbf7a719 100644
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -2433,20 +2433,7 @@ static void azx_remove(struct pci_dev *pci)
/* cancel the pending probing work */
chip = card->private_data;
hda = container_of(chip, struct hda_intel, chip);
- /* FIXME: below is an ugly workaround.
- * Both device_release_driver() and driver_probe_device()
- * take *both* the device's and its parent's lock before
- * calling the remove() and probe() callbacks. The codec
- * probe takes the locks of both the codec itself and its
- * parent, i.e. the PCI controller dev. Meanwhile, when
- * the PCI controller is unbound, it takes its lock, too
- * ==> ouch, a deadlock!
- * As a workaround, we unlock temporarily here the controller
- * device during cancel_work_sync() call.
- */
- device_unlock(&pci->dev);
cancel_delayed_work_sync(&hda->probe_work);
- device_lock(&pci->dev);
clear_bit(chip->dev_index, probed_devs);
pci_set_drvdata(pci, NULL);
---
base-commit: 39b68f430a1b299a041ce44a695ae9ddb2576ca1
change-id: 20260328-hda-intel-drop-obsolete-probe-workaround-d7d2a5528caf
Best regards,
--
Cássio Gabriel <cassiogabrielcontato@gmail.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] ALSA: hda: intel: Drop obsolete probe-work unlock workaround
2026-03-28 23:42 [PATCH] ALSA: hda: intel: Drop obsolete probe-work unlock workaround Cássio Gabriel
@ 2026-03-29 9:07 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-03-29 9:07 UTC (permalink / raw)
To: Cássio Gabriel
Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel
On Sun, 29 Mar 2026 00:42:01 +0100,
Cássio Gabriel wrote:
>
> Commit ab949d519601 ("ALSA: hda - Fix deadlock of controller device
> lock at unbinding") added a temporary device_unlock()/device_lock()
> pair around probe-work cancellation to avoid a deadlock between
> controller unbind and codec probe.
>
> That deadlock depended on the driver core taking both a device lock and
> its parent lock during bind and unbind. Since commit 8c97a46af04b
> ("driver core: hold dev's parent lock when needed") and follow-up
> fixes, the parent lock is only taken when bus->need_parent_lock is set.
> The HDA bus does not set that flag, so codec binding no longer locks
> the controller device as the codec's parent.
>
> Keep cancel_delayed_work_sync(), since the async probe/remove race
> still needs to be serialized, but drop the stale unlock/relock
> workaround and its outdated FIXME comment. Keeping it around only
> opens an unnecessary unlocked window inside azx_remove().
>
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
A good catch. Applied to for-next branch now.
thanks,
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-29 9:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-28 23:42 [PATCH] ALSA: hda: intel: Drop obsolete probe-work unlock workaround Cássio Gabriel
2026-03-29 9:07 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox