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 <j...@joelfernandes.org>
To: Pierre-Louis Bossart <pierre-louis.boss...@linux.intel.com>
To: Liam Girdwood <lgirdw...@gmail.com>
To: Peter Ujfalusi <peter.ujfal...@linux.intel.com>
To: Bard Liao <yung-chuan.l...@linux.intel.com>
To: Ranjani Sridharan <ranjani.sridha...@linux.intel.com>
To: Kai Vehmanen <kai.vehma...@linux.intel.com>
To: Daniel Baluta <daniel.bal...@nxp.com>
To: Mark Brown <broo...@kernel.org>
To: Jaroslav Kysela <pe...@perex.cz>
To: Takashi Iwai <ti...@suse.com>
To: Eric Biederman <ebied...@xmission.com>
To: Chromeos Kdump <chromeos-kd...@google.com>
To: Steven Rostedt <rost...@goodmis.org>
To: Michael Ellerman <m...@ellerman.id.au>
To: Nicholas Piggin <npig...@gmail.com>
To: Christophe Leroy <christophe.le...@csgroup.eu>
To: "K. Y. Srinivasan" <k...@microsoft.com>
To: Haiyang Zhang <haiya...@microsoft.com>
To: Wei Liu <wei....@kernel.org>
To: Dexuan Cui <de...@microsoft.com>
To: Thomas Gleixner <t...@linutronix.de>
To: Ingo Molnar <mi...@redhat.com>
To: Borislav Petkov <b...@alien8.de>
To: Dave Hansen <dave.han...@linux.intel.com>
To: x...@kernel.org
To: "H. Peter Anvin" <h...@zytor.com>
To: Juergen Gross <jgr...@suse.com>
To: Boris Ostrovsky <boris.ostrov...@oracle.com>
To: Ard Biesheuvel <a...@kernel.org>
To: Bjorn Helgaas <bhelg...@google.com>
To: "Rafael J. Wysocki" <raf...@kernel.org>
To: Pavel Machek <pa...@ucw.cz>
To: Len Brown <len.br...@intel.com>
Cc: sta...@vger.kernel.org
Cc: sound-open-firmw...@alsa-project.org
Cc: alsa-de...@alsa-project.org
Cc: linux-ker...@vger.kernel.org
Cc: ke...@lists.infradead.org
Cc: linuxppc-dev@lists.ozlabs.org
Cc: linux-hyp...@vger.kernel.org
Cc: xen-de...@lists.xenproject.org
Cc: linux-...@vger.kernel.org
Cc: linux-...@vger.kernel.org
Cc: linux...@vger.kernel.org
Signed-off-by: Ricardo Ribalda <riba...@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-127c582f1...@chromium.org

Changes in v7:
- Fix commit message (Thanks Pierre-Louis).
- Link to v6: 
https://lore.kernel.org/r/20221127-snd-freeze-v6-0-3e90553f6...@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-4ededeb08...@chromium.org

Changes in v5:
- Edit subject prefix.
- Link to v4: 
https://lore.kernel.org/r/20221127-snd-freeze-v4-0-51ca64b7f...@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-a2eda731c...@chromium.org

Changes in v3:
- Wrap pm_freezing in a function.
- Link to v2: 
https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9...@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-57461a366...@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 <riba...@chromium.org>

Reply via email to