[PATCH 2/2] ASoC: SOF: Revert: "core: unregister clients and machine drivers in .shutdown"

Kai Vehmanen kai.vehmanen at linux.intel.com
Fri Dec 9 15:27:40 CET 2022


Hi,

On Fri, 9 Dec 2022, Mark Brown wrote:

> On Fri, Dec 09, 2022 at 01:45:29PM +0200, Kai Vehmanen wrote:
> 
> > This reverts commit 83bfc7e793b555291785136c3ae86abcdc046887.
> 
> Please include human readable descriptions of things like commits and
> issues being discussed in e-mail in your mails, this makes them much

ack, will fix in V2. 

> easier for humans to read especially when they have no internet access.
> I do frequently catch up on my mail on flights or while otherwise
> travelling so this is even more pressing for me than just being about
> making things a bit easier to read.
> 
> > -	/*
> > -	 * make sure clients and machine driver(s) are unregistered to force
> > -	 * all userspace devices to be closed prior to the DSP shutdown sequence
> > -	 */
> > -	sof_unregister_clients(sdev);
> > -
> > -	snd_sof_machine_unregister(sdev, pdata);
> > -
> 
> I am somewhat surprised that these block on the kernel side rather than
> just disconnecting the kernel side of whatever userspace sees - I'd
> thought they were more like hotplug operations than something blocking.

Yes, this is not so obvious. The machine unregister ends up 
in soc-core.c:soc_cleanup_card_resources()

--cut--
static void soc_cleanup_card_resources(struct snd_soc_card *card)
{
»       struct snd_soc_pcm_runtime *rtd, *n;

»       if (card->snd_card)
»       »       snd_card_disconnect_sync(card->snd_card);
--cut--

... and there we have the "sync" variant call that gets us in trouble
with e.g. kexec().

This seems to be only user of snd_card_disconnect_sync(), but it was 
specifically added to fix a bug in commit 0ced7b050224 ("ASoC: soc-pcm: 
remove soc_pcm_private_free()").

Br, Kai


More information about the Alsa-devel mailing list