[PATCH v3 0/2] ALSA: core: Fix deadlock when shutdown a frozen userspace
Takashi Iwai
tiwai at suse.de
Mon Nov 28 10:24:07 CET 2022
On Mon, 28 Nov 2022 10:10:12 +0100,
Ricardo Ribalda wrote:
>
> Since 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown")
> we wait for userspace to close its fds.
IMO, the fix above brought more problem. If you'd need to want to
avoid later accesses during shutdown, the driver should rather just
disconnect devices without waiting for the user-space completion.
And, for that, a simple call of snd_card_disconnect() should suffice.
> But that will never occur with a frozen userspace (like during kexec()).
>
> Lets detect the frozen userpace and act accordingly.
... and skipping the user-space sync at snd_card_disconnect_sync() as
of this patch set is a dangerous move, I'm afraid. The user-space
gets frozen also at the normal suspend/resume, and it implies that the
sync will be lost even for the normal PM, too (although it must be a
very corner case).
thanks,
Takashi
>
> To: Jaroslav Kysela <perex at perex.cz>
> To: Takashi Iwai <tiwai at suse.com>
> To: "Rafael J. Wysocki" <rafael at kernel.org>
> To: Pavel Machek <pavel at ucw.cz>
> To: Len Brown <len.brown at intel.com>
> To: Kai Vehmanen <kai.vehmanen at linux.intel.com>
> To: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
> To: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
> To: Mark Brown <broonie at kernel.org>
> Cc: alsa-devel at alsa-project.org
> Cc: linux-kernel at vger.kernel.org
> Cc: "Joel Fernandes (Google)" <joel at joelfernandes.org>
> Cc: linux-pm at vger.kernel.org
> Signed-off-by: Ricardo Ribalda <ribalda at chromium.org>
> ---
> Changes in v3:
> - Wrap pm_freezing in a function
> - Link to v2: https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@chromium.org
>
> Changes in v2:
> - Only use pm_freezing if CONFIG_FREEZER
> - Link to v1: https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@chromium.org
>
> ---
> Ricardo Ribalda (2):
> freezer: Add processes_frozen()
> ALSA: core: Fix deadlock when shutdown a frozen userspace
>
> include/linux/freezer.h | 2 ++
> kernel/freezer.c | 11 +++++++++++
> sound/core/init.c | 13 +++++++++++++
> 3 files changed, 26 insertions(+)
> ---
> base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
> change-id: 20221127-snd-freeze-1ee143228326
>
> Best regards,
> --
> Ricardo Ribalda <ribalda at chromium.org>
>
More information about the Alsa-devel
mailing list