Re: [PATCH v4] ALSA: core: Fix deadlock when shutdown a frozen userspace

From: Takashi Iwai
Date: Mon Nov 28 2022 - 08:48:03 EST


On Mon, 28 Nov 2022 14:42:49 +0100,
Ricardo Ribalda wrote:
>
> During kexec(), the userspace is frozen. Therefore we cannot wait for it
> to complete.
>
> Avoid running snd_sof_machine_unregister during shutdown.
>
> This fixes:
>
> [ 84.943749] Freezing user space processes ... (elapsed 0.111 seconds) done.
> [ 246.784446] INFO: task kexec-lite:5123 blocked for more than 122 seconds.
> [ 246.819035] Call Trace:
> [ 246.821782] <TASK>
> [ 246.824186] __schedule+0x5f9/0x1263
> [ 246.828231] schedule+0x87/0xc5
> [ 246.831779] snd_card_disconnect_sync+0xb5/0x127
> ...
> [ 246.889249] snd_sof_device_shutdown+0xb4/0x150
> [ 246.899317] pci_device_shutdown+0x37/0x61
> [ 246.903990] device_shutdown+0x14c/0x1d6
> [ 246.908391] kernel_kexec+0x45/0xb9
>
> And:
>
> [ 246.893222] INFO: task kexec-lite:4891 blocked for more than 122 seconds.
> [ 246.927709] Call Trace:
> [ 246.930461] <TASK>
> [ 246.932819] __schedule+0x5f9/0x1263
> [ 246.936855] ? fsnotify_grab_connector+0x5c/0x70
> [ 246.942045] schedule+0x87/0xc5
> [ 246.945567] schedule_timeout+0x49/0xf3
> [ 246.949877] wait_for_completion+0x86/0xe8
> [ 246.954463] snd_card_free+0x68/0x89
> ...
> [ 247.001080] platform_device_unregister+0x12/0x35
>
> Cc: stable@xxxxxxxxxxxxxxx
> Fixes: 83bfc7e793b5 ("ASoC: SOF: core: unregister clients and machine drivers in .shutdown")
> Signed-off-by: Ricardo Ribalda <ribalda@xxxxxxxxxxxx>
> ---
> 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>
> Cc: sound-open-firmware@xxxxxxxxxxxxxxxx
> Cc: alsa-devel@xxxxxxxxxxxxxxxx
> Cc: linux-kernel@xxxxxxxxxxxxxxx
> ---
> 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

The subject prefix should be adjusted -- now it's no longer about ALSA
core but specific to ASoC SOF.


thanks,

Takashi