[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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@xxxxxxxxxxxxxxxxx>
To: Pierre-Louis Bossart <pierre-louis.bossart@xxxxxxxxxxxxxxx>
To: Liam Girdwood <lgirdwood@xxxxxxxxx>
To: Peter Ujfalusi <peter.ujfalusi@xxxxxxxxxxxxxxx>
To: Bard Liao <yung-chuan.liao@xxxxxxxxxxxxxxx>
To: Ranjani Sridharan <ranjani.sridharan@xxxxxxxxxxxxxxx>
To: Kai Vehmanen <kai.vehmanen@xxxxxxxxxxxxxxx>
To: Daniel Baluta <daniel.baluta@xxxxxxx>
To: Mark Brown <broonie@xxxxxxxxxx>
To: Jaroslav Kysela <perex@xxxxxxxx>
To: Takashi Iwai <tiwai@xxxxxxxx>
To: Eric Biederman <ebiederm@xxxxxxxxxxxx>
To: Chromeos Kdump <chromeos-kdump@xxxxxxxxxx>
To: Steven Rostedt <rostedt@xxxxxxxxxxx>
To: Michael Ellerman <mpe@xxxxxxxxxxxxxx>
To: Nicholas Piggin <npiggin@xxxxxxxxx>
To: Christophe Leroy <christophe.leroy@xxxxxxxxxx>
To: "K. Y. Srinivasan" <kys@xxxxxxxxxxxxx>
To: Haiyang Zhang <haiyangz@xxxxxxxxxxxxx>
To: Wei Liu <wei.liu@xxxxxxxxxx>
To: Dexuan Cui <decui@xxxxxxxxxxxxx>
To: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
To: Ingo Molnar <mingo@xxxxxxxxxx>
To: Borislav Petkov <bp@xxxxxxxxx>
To: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
To: x86@xxxxxxxxxx
To: "H. Peter Anvin" <hpa@xxxxxxxxx>
To: Juergen Gross <jgross@xxxxxxxx>
To: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
To: Ard Biesheuvel <ardb@xxxxxxxxxx>
To: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
To: "Rafael J. Wysocki" <rafael@xxxxxxxxxx>
To: Pavel Machek <pavel@xxxxxx>
To: Len Brown <len.brown@xxxxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Cc: sound-open-firmware@xxxxxxxxxxxxxxxx
Cc: alsa-devel@xxxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: kexec@xxxxxxxxxxxxxxxxxxx
Cc: linuxppc-dev@xxxxxxxxxxxxxxxx
Cc: linux-hyperv@xxxxxxxxxxxxxxx
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
Cc: linux-efi@xxxxxxxxxxxxxxx
Cc: linux-pci@xxxxxxxxxxxxxxx
Cc: linux-pm@xxxxxxxxxxxxxxx
Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
---
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@xxxxxxxxxxxx

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

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@xxxxxxxxxxxx

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

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@xxxxxxxxxxxx

Changes in v3:
- Wrap pm_freezing in a function.
- Link to v2: 
https://lore.kernel.org/r/20221127-snd-freeze-v2-0-d8a425ea9663@xxxxxxxxxxxx

Changes in v2:
- Only use pm_freezing if CONFIG_FREEZER .
- Link to v1: 
https://lore.kernel.org/r/20221127-snd-freeze-v1-0-57461a366ec2@xxxxxxxxxxxx

---
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@xxxxxxxxxxxx>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.