* [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails
@ 2026-11-19 16:22 Kai Vehmanen
2026-11-19 16:32 ` Michał Grzelak
2026-11-19 16:45 ` sashiko-bot
0 siblings, 2 replies; 3+ messages in thread
From: Kai Vehmanen @ 2026-11-19 16:22 UTC (permalink / raw)
To: linux-sound, tiwai, Peter Ujfalusi; +Cc: kai.vehmanen, Michal Grzelak
Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
work") stopped freeing the card from azx_probe_work() when the delayed
probe fails, and only disconnects it, leaving the free to azx_remove().
This avoids the double free, but the resources that were released by
the card free via azx_free() are now kept until the PCI device is
unbound. In particular the display power reference and the audio
component binding to the graphics driver stay held for a controller
that will never become operational. This blocks unloading of the i915
driver, which breaks display driver reload.
Release the display power and the i915 audio component in the probe
work error path. Both snd_hdac_display_power() and snd_hdac_acomp_exit()
are safe to repeat, so the later azx_free() call from azx_remove() is
not affected. azx_free() can't be called directly here as it would
run before the codec instances are released by the card free.
Fixes: fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe work")
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
Reported-by: Michal Grzelak <michal.grzelak@intel.com>
Tested-by-by: Michal Grzelak <michal.grzelak@intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
sound/hda/controllers/intel.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
index 0a62723b3454..73ff42faccb7 100644
--- a/sound/hda/controllers/intel.c
+++ b/sound/hda/controllers/intel.c
@@ -1740,9 +1740,21 @@ static void azx_probe_work(struct work_struct *work)
struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
if (azx_probe_continue(&hda->chip, false) < 0) {
+ struct azx *chip = &hda->chip;
+
hda->init_failed = 1;
complete_all(&hda->probe_wait);
- snd_card_disconnect(hda->chip.card);
+ snd_card_disconnect(chip->card);
+
+ /*
+ * The card itself is left to azx_remove() to free, but the
+ * graphics driver must not be kept bound to a controller that
+ * will never become operational; this would e.g. block
+ * unloading i915. Both calls are safe to repeat from azx_free().
+ */
+ display_power(chip, false);
+ if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT)
+ snd_hdac_i915_exit(azx_bus(chip));
}
}
base-commit: ec925d3740159f4b4bd3b7640be5d0d2b4664106
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails
2026-11-19 16:22 [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails Kai Vehmanen
@ 2026-11-19 16:32 ` Michał Grzelak
2026-11-19 16:45 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: Michał Grzelak @ 2026-11-19 16:32 UTC (permalink / raw)
To: Kai Vehmanen; +Cc: linux-sound, tiwai, Peter Ujfalusi, Michal Grzelak
On Thu, Nov 19, 2026 at 06:22:53PM GMT, Kai Vehmanen wrote:
> Commit fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe
> work") stopped freeing the card from azx_probe_work() when the delayed
> probe fails, and only disconnects it, leaving the free to azx_remove().
> This avoids the double free, but the resources that were released by
> the card free via azx_free() are now kept until the PCI device is
> unbound. In particular the display power reference and the audio
> component binding to the graphics driver stay held for a controller
> that will never become operational. This blocks unloading of the i915
> driver, which breaks display driver reload.
>
> Release the display power and the i915 audio component in the probe
> work error path. Both snd_hdac_display_power() and snd_hdac_acomp_exit()
> are safe to repeat, so the later azx_free() call from azx_remove() is
> not affected. azx_free() can't be called directly here as it would
> run before the codec instances are released by the card free.
>
> Fixes: fbaccb1b19c7 ("ALSA: hda: intel: Don't free card in the probe work")
> Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
> Reported-by: Michal Grzelak <michal.grzelak@intel.com>
> Tested-by-by: Michal Grzelak <michal.grzelak@intel.com>
nitpick: s/Tested-by-by:/Tested-by:/
:)
BR,
Michał
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> ---
> sound/hda/controllers/intel.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
> index 0a62723b3454..73ff42faccb7 100644
> --- a/sound/hda/controllers/intel.c
> +++ b/sound/hda/controllers/intel.c
> @@ -1740,9 +1740,21 @@ static void azx_probe_work(struct work_struct *work)
> struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
>
> if (azx_probe_continue(&hda->chip, false) < 0) {
> + struct azx *chip = &hda->chip;
> +
> hda->init_failed = 1;
> complete_all(&hda->probe_wait);
> - snd_card_disconnect(hda->chip.card);
> + snd_card_disconnect(chip->card);
> +
> + /*
> + * The card itself is left to azx_remove() to free, but the
> + * graphics driver must not be kept bound to a controller that
> + * will never become operational; this would e.g. block
> + * unloading i915. Both calls are safe to repeat from azx_free().
> + */
> + display_power(chip, false);
> + if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT)
> + snd_hdac_i915_exit(azx_bus(chip));
> }
> }
>
>
> base-commit: ec925d3740159f4b4bd3b7640be5d0d2b4664106
> --
> 2.43.0
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails
2026-11-19 16:22 [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails Kai Vehmanen
2026-11-19 16:32 ` Michał Grzelak
@ 2026-11-19 16:45 ` sashiko-bot
1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-11-19 16:45 UTC (permalink / raw)
To: Kai Vehmanen, linux-sound
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ALSA: hda: intel: azx_probe_work() drops display power before
stopping chip
- [Medium] ALSA: hda: intel: azx_probe_work() exits i915 while codecs
remain registered
--
commit 8668fbf5bb132662ae06081f1c3f17768cfd79c9
Author: Kai Vehmanen <kai.vehmanen@linux.intel.com>
ALSA: hda: intel: Release i915 component when delayed probe fails
This commit releases display power and exits the i915 audio component in
azx_probe_work() when azx_probe_continue() fails, so the graphics driver
is not kept bound until azx_remove() frees the card.
Link: https://gitlab.freedesktop.org/drm/i915/kernel/-/work_items/17751
> diff --git a/sound/hda/controllers/intel.c b/sound/hda/controllers/intel.c
> index 0a62723b34549..73ff42faccb77 100644
> --- a/sound/hda/controllers/intel.c
> +++ b/sound/hda/controllers/intel.c
> @@ -1740,9 +1740,21 @@ static void azx_probe_work(struct work_struct *work)
> struct hda_intel *hda = container_of(work, struct hda_intel, probe_work.work);
>
> if (azx_probe_continue(&hda->chip, false) < 0) {
> + struct azx *chip = &hda->chip;
> +
> hda->init_failed = 1;
> complete_all(&hda->probe_wait);
> - snd_card_disconnect(hda->chip.card);
> + snd_card_disconnect(chip->card);
> +
> + /*
> + * The card itself is left to azx_remove() to free, but the
> + * graphics driver must not be kept bound to a controller that
> + * will never become operational; this would e.g. block
> + * unloading i915. Both calls are safe to repeat from azx_free().
> + */
> + display_power(chip, false);
> + if (chip->driver_caps & AZX_DCAPS_I915_COMPONENT)
> + snd_hdac_i915_exit(azx_bus(chip));
[Severity: Medium]
Should the controller be stopped before dropping display power and exiting
the i915 component?
When azx_probe_continue() fails after azx_first_init() (for example in
azx_probe_codecs() or azx_codec_configure()), hda_intel_init_chip() has
already started CORB/RIRB DMA, enabled controller interrupts, and set
bus->chip_init = true. Unlike __azx_shutdown_chip() and azx_free(), this
path releases display power while the controller is still running.
On platforms where the HDA controller sits in the GPU display power domain
(hda->need_i915_power), powering down the domain with DMA active leaves
bus->chip_init set, so when azx_remove() later runs azx_free(), it accesses
and polls controller MMIO registers after display power and the i915
component have already been released:
sound/hda/controllers/intel.c:azx_free() {
...
if (bus->chip_init) {
azx_clear_irq_pending(chip);
azx_stop_all_streams(chip);
azx_stop_chip(chip);
}
...
}
[Severity: Medium]
Can exiting the i915 component here trigger WARN_ON(bus->display_power_active)
or leave codec devices registered on the bus without an audio component?
snd_card_disconnect() does not unregister or free SNDRV_DEV_CODEC devices.
If azx_probe_continue() fails in snd_hda_card_register() after
snd_hda_codec_register() has enabled per-codec display power via
snd_hda_codec_display_power(codec, true), display_power(chip, false) only
clears HDA_CODEC_IDX_CONTROLLER in bus->display_power_status. The codec's
bit remains set until snd_card_free() runs in azx_remove(), so
snd_hdac_i915_exit() -> snd_hdac_acomp_exit() hits
WARN_ON(bus->display_power_active).
In addition, when azx_codec_configure() fails for all codecs (success == 0),
codec->core.dev stays registered on snd_hda_bus_type and in sysfs after
bus->audio_component is torn down, allowing late codec driver binding or
sysfs reconfig_codec() to run against a controller with no display power or
audio component.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261119162253.1779252-1-kai.vehmanen@linux.intel.com?part=1
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-19 16:45 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-19 16:22 [PATCH] ALSA: hda: intel: Release i915 component when delayed probe fails Kai Vehmanen
2026-11-19 16:32 ` Michał Grzelak
2026-11-19 16:45 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox