[PATCH v8 0/3] ASoC: SOF: Fix deadlock when shutdown a frozen userspace

Ricardo Ribalda ribalda at chromium.org
Thu Dec 1 03:08:20 PST 2022


Since: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown")
we wait for all the workloads to be completed during shutdown. This was done to 
avoid a stall once the device is started again.

Unfortunately this has the side effect of stalling kexec(), if the userspace
is frozen. Let's handle that case.

To: Joel Fernandes <joel at joelfernandes.org>
To: Pierre-Louis Bossart <pierre-louis.bossart at linux.intel.com>
To: Liam Girdwood <lgirdwood at gmail.com>
To: Peter Ujfalusi <peter.ujfalusi at linux.intel.com>
To: Bard Liao <yung-chuan.liao at linux.intel.com>
To: Ranjani Sridharan <ranjani.sridharan at linux.intel.com>
To: Kai Vehmanen <kai.vehmanen at linux.intel.com>
To: Daniel Baluta <daniel.baluta at nxp.com>
To: Mark Brown <broonie at kernel.org>
To: Jaroslav Kysela <perex at perex.cz>
To: Takashi Iwai <tiwai at suse.com>
To: Eric Biederman <ebiederm at xmission.com>
To: Chromeos Kdump <chromeos-kdump at google.com>
To: Steven Rostedt <rostedt at goodmis.org>
To: Michael Ellerman <mpe at ellerman.id.au>
To: Nicholas Piggin <npiggin at gmail.com>
To: Christophe Leroy <christophe.leroy at csgroup.eu>
To: "K. Y. Srinivasan" <kys at microsoft.com>
To: Haiyang Zhang <haiyangz at microsoft.com>
To: Wei Liu <wei.liu at kernel.org>
To: Dexuan Cui <decui at microsoft.com>
To: Thomas Gleixner <tglx at linutronix.de>
To: Ingo Molnar <mingo at redhat.com>
To: Borislav Petkov <bp at alien8.de>
To: Dave Hansen <dave.hansen at linux.intel.com>
To: x86 at kernel.org
To: "H. Peter Anvin" <hpa at zytor.com>
To: Juergen Gross <jgross at suse.com>
To: Boris Ostrovsky <boris.ostrovsky at oracle.com>
To: Ard Biesheuvel <ardb at kernel.org>
To: Bjorn Helgaas <bhelgaas at google.com>
To: "Rafael J. Wysocki" <rafael at kernel.org>
To: Pavel Machek <pavel at ucw.cz>
To: Len Brown <len.brown at intel.com>
Cc: stable at vger.kernel.org
Cc: sound-open-firmware at alsa-project.org
Cc: alsa-devel at alsa-project.org
Cc: linux-kernel at vger.kernel.org
Cc: kexec at lists.infradead.org
Cc: linuxppc-dev at lists.ozlabs.org
Cc: linux-hyperv at vger.kernel.org
Cc: xen-devel at lists.xenproject.org
Cc: linux-efi at vger.kernel.org
Cc: linux-pci at vger.kernel.org
Cc: linux-pm at vger.kernel.org
Signed-off-by: Ricardo Ribalda <ribalda at chromium.org>
---
Changes in v8:
- Wrap pm_freezing and kexec_inprogress in functions.
- Do not run snd_sof_machine_unregister(sdev, pdata) during kexec (Thanks Kai).
- Link to v7: https://lore.kernel.org/r/20221127-snd-freeze-v7-0-127c582f1ca4@chromium.org

Changes in v7:
- Fix commit message (Thanks Pierre-Louis).
- Link to v6: https://lore.kernel.org/r/20221127-snd-freeze-v6-0-3e90553f64a5@chromium.org

Changes in v6:
- Check if we are in kexec with the userspace frozen.
- Link to v5: https://lore.kernel.org/r/20221127-snd-freeze-v5-0-4ededeb08ba0@chromium.org

Changes in v5:
- Edit subject prefix.
- Link to v4: https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f2ab@chromium.org

Changes in v4:
- Do not call snd_sof_machine_unregister from shutdown.
- Link to v3: https://lore.kernel.org/r/20221127-snd-freeze-v3-0-a2eda731ca14@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 (3):
      kexec: Refactor kexec_in_progress into a function
      freezer: refactor pm_freezing into a function.
      ASoC: SOF: Fix deadlock when shutdown a frozen userspace

 arch/powerpc/platforms/pseries/vio.c |  2 +-
 arch/x86/kernel/cpu/mshyperv.c       |  6 +++---
 arch/x86/xen/enlighten_hvm.c         |  2 +-
 drivers/firmware/efi/efi.c           |  2 +-
 drivers/pci/pci-driver.c             |  2 +-
 include/linux/freezer.h              |  3 ++-
 include/linux/kexec.h                |  5 ++---
 kernel/freezer.c                     |  3 +--
 kernel/kexec_core.c                  | 12 ++++++++++--
 kernel/power/process.c               | 24 ++++++++++++++++++++----
 sound/soc/sof/core.c                 |  9 ++++++---
 11 files changed, 48 insertions(+), 22 deletions(-)
---
base-commit: 4312098baf37ee17a8350725e6e0d0e8590252d4
change-id: 20221127-snd-freeze-1ee143228326

Best regards,
-- 
Ricardo Ribalda <ribalda at chromium.org>



More information about the kexec mailing list