[PATCH v7 2/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
Kai Vehmanen
kai.vehmanen at linux.intel.com
Thu Dec 1 01:03:46 PST 2022
Hi,
On Wed, 30 Nov 2022, Ricardo Ribalda wrote:
> During kexec(), the userspace might frozen. Therefore we cannot wait
> for it to complete.
[...]
> --- a/sound/soc/sof/core.c
> +++ b/sound/soc/sof/core.c
> @@ -9,6 +9,7 @@
> //
>
> #include <linux/firmware.h>
> +#include <linux/kexec.h>
> #include <linux/module.h>
> #include <sound/soc.h>
> #include <sound/sof.h>
> @@ -484,7 +485,8 @@ int snd_sof_device_shutdown(struct device *dev)
> * 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);
> + if (!kexec_with_frozen_processes())
> + sof_unregister_clients(sdev);
>
> snd_sof_machine_unregister(sdev, pdata);
I think the case you hit was specifically snd_card_disconnect_sync() that
gets called via snd_sof_machine_unregister(), right, so you'd have to skip
both sof_unregister_clients() and the machine_unregister().
Skipping ok might be an ok solution here. There's clearly a problem and we
cannot just drop these calls in the general case (when we are going to
S5), but in the specific case of kexec, this is probably safe. And I agree
one way or another this needs to be fixed. Pierre and others what do you
think?
Br, Kai
More information about the kexec
mailing list