From: Cezary Rojewski <cezary.rojewski@intel.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: <linux-kernel@vger.kernel.org>, <linux-sound@vger.kernel.org>
Subject: Re: [PATCH 1/3] ALSA: hda: Stop unsol events and jack polling before codec unbind
Date: Thu, 8 Oct 2026 13:52:42 +0200 [thread overview]
Message-ID: <8a57e670-2b8f-480f-b313-850561bc9090@intel.com> (raw)
In-Reply-To: <87ik3c5wfq.wl-tiwai@suse.de>
On 10/8/2026 12:16 PM, Takashi Iwai wrote:
> On Thu, 08 Oct 2026 11:08:13 +0200,
> Cezary Rojewski wrote:
>>
>> On 10/7/2026 11:56 PM, Takashi Iwai wrote:
>>> +++ b/sound/hda/common/bind.c
>>> @@ -100,6 +100,9 @@ static int hda_codec_driver_probe(struct device *dev)
>>> if (WARN_ON(!codec->preset))
>>> return -EINVAL;
>>>
>>> + /* unsol events are still blocked until registered */
>>> + codec->core.unsol_disabled = false;
>>> +
>>> err = snd_hda_codec_set_name(codec, codec->preset->name);
>>> if (err < 0)
>>> goto error;
>>> @@ -160,6 +163,10 @@ static int hda_codec_driver_remove(struct device *dev)
>>> return codec->bus->core.ext_ops->hdev_detach(&codec->core);
>>> }
>>>
>>> + /* stop asynchronous jack handling before freeing driver resources */
>>> + snd_hdac_device_disable_unsol(&codec->core);
>>> + cancel_delayed_work_sync(&codec->jackpoll_work);
>>
>>
>> IMHO this is a proof that ->registered flag doesn't do its job.
>> snd_hda_codec_cleanup_for_unbind() is called right after and it does
>> contain cancel_delayed_work_sync(&codec->jackpoll_work). It does
>> contain snd_hda_codec_disconnect_pcms() and
>> snd_hda_jack_tbl_disconnect() operations too.
>
> It's about the pending works, and the flag doesn't help there alone
> unless they are synchronized; at the time point you flip the flag, the
> work might be already in-flight, so the flag switch may miss the
> chances.
I agree, my suggestion was to make ->registered the sole owner of the
subject, including the synchronization. At the same time, fixing the
problem first and expanding the work later is also a valid approach.
Do you have a method for reproducing the problem easily?
>> I'd say it is snd_hda_codec_cleanup_for_unbind() that needs an update
>> and perhaps be responsible for calling driver->remove() too.
>
> Yeah, some code reorganization would be good.
next prev parent reply other threads:[~2026-10-08 11:52 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 21:56 [PATCH 0/3] ALSA/ASoC: hda: Fix race between unsol events and unbind Takashi Iwai
2026-10-07 21:56 ` [PATCH 1/3] ALSA: hda: Stop unsol events and jack polling before codec unbind Takashi Iwai
2026-10-08 9:08 ` Cezary Rojewski
2026-10-08 10:16 ` Takashi Iwai
2026-10-08 11:52 ` Cezary Rojewski [this message]
2026-10-08 12:01 ` Takashi Iwai
2026-10-07 21:56 ` [PATCH 2/3] ASoC: codecs: hda: Stop unsol events and jack polling before codec removal Takashi Iwai
2026-10-07 21:56 ` [PATCH 3/3] ALSA: hda: Make hdac_device.registered a plain bool Takashi Iwai
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=8a57e670-2b8f-480f-b313-850561bc9090@intel.com \
--to=cezary.rojewski@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=tiwai@suse.de \
/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
all inboxes | Powered by JetHome®