lkml.org 
[lkml]   [2022]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v7 2/2] ASoC: SOF: Fix deadlock when shutdown a frozen userspace
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

\
 
 \ /
  Last update: 2022-12-01 10:06    [W:0.102 / U:0.552 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site