[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.22.394.2212011053540.3532114@eliteleevi.tm.intel.com>
Date: Thu, 1 Dec 2022 11:03:46 +0200 (EET)
From: Kai Vehmanen <kai.vehmanen@...ux.intel.com>
To: Ricardo Ribalda <ribalda@...omium.org>
cc: Steven Rostedt <rostedt@...dmis.org>,
Peter Ujfalusi <peter.ujfalusi@...ux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>,
Jaroslav Kysela <perex@...ex.cz>,
Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
Chromeos Kdump <chromeos-kdump@...gle.com>,
Mark Brown <broonie@...nel.org>,
Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
Eric Biederman <ebiederm@...ssion.com>,
Bard Liao <yung-chuan.liao@...ux.intel.com>,
Daniel Baluta <daniel.baluta@....com>,
Liam Girdwood <lgirdwood@...il.com>,
Takashi Iwai <tiwai@...e.com>,
Alsa-devel <alsa-devel@...a-project.org>,
sound-open-firmware@...a-project.org, kexec@...ts.infradead.org,
stable@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [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
Powered by blists - more mailing lists