FAILED: patch "[PATCH] ASoC: SOF: core: release resources on errors in" failed to apply to 5.5-stable tree
Subsystems (4)
[email protected]
maintainerThe patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 410e5e55c9c1c9c0d452ac5b9adb37b933a7747e Mon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 24 Jan 2020 15:36:21 -0600
Subject: [PATCH] ASoC: SOF: core: release resources on errors in
probe_continue
The initial intent of releasing resources in the .remove does not work well with HDaudio codecs. If the probe_continue() fails in a work queue, e.g. due to missing firmware or authentication issues, we don't release any resources, and as a result the kernel oopses during suspend operations.
The suggested fix is to release all resources during errors in probe_continue(), and use fw_state to track resource allocation state, so that .remove does not attempt to release the same hardware resources twice. PM operations are also modified so that no action is done if DSP resources have been freed due to an error at probe.
Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1161246
sound/soc/sof/core.c +12 -21
@@ -244,7 +244,6 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)return 0 ; -#if !IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE ) fw_trace_err:snd_sof_free_trace (sdev); fw_run_err:
@@ -255,22 +254,10 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)snd_sof_free_debug (sdev); dbg_err:snd_sof_remove (sdev); -#else -/* -* when the probe_continue is handled in a work queue, the -* probe does not fail so we don't release resources here. -* They will be released with an explicit call to -* snd_sof_device_remove() when the PCI/ACPI device is removed -*/ - -fw_trace_err: -fw_run_err: -fw_load_err: -ipc_err: -dbg_err: - -#endif +/* all resources freed, update state to match */ + sdev->fw_state =SOF_FW_BOOT_NOT_STARTED ; + sdev->first_boot = true;return ret; }
@@ -353,10 +340,12 @@ int snd_sof_device_remove(struct device *dev)if (IS_ENABLED (CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE ))cancel_work_sync (&sdev->probe_work); -snd_sof_fw_unload (sdev); -snd_sof_ipc_free (sdev); -snd_sof_free_debug (sdev); -snd_sof_free_trace (sdev); +if (sdev->fw_state >SOF_FW_BOOT_NOT_STARTED ) { +snd_sof_fw_unload (sdev); +snd_sof_ipc_free (sdev); +snd_sof_free_debug (sdev); +snd_sof_free_trace (sdev); + }/* * Unregister machine driver. This will unbind the snd_card which
@@ -364,13 +353,15 @@ int snd_sof_device_remove(struct device *dev)* before freeing the snd_card. */ snd_sof_machine_unregister (sdev, pdata); +/* * Unregistering the machine driver results in unloading the topology. * Some widgets, ex: scheduler, attempt to power down the core they are * scheduled on, when they are unloaded. Therefore, the DSP must be * removed only after the topology has been unloaded. */ -snd_sof_remove (sdev); +if (sdev->fw_state >SOF_FW_BOOT_NOT_STARTED ) +snd_sof_remove (sdev);/* release firmware */ release_firmware (pdata->fw);
sound/soc/sof/pm.c +4 -0
@@ -56,6 +56,10 @@ static int sof_resume(struct device *dev, bool runtime_resume)if (!sof_ops (sdev)->resume || !sof_ops (sdev)->runtime_resume)return 0 ; +/* DSP was never successfully started, nothing to resume */ +if (sdev->first_boot) +return 0 ; +/* * if the runtime_resume flag is set, call the runtime_resume routine * or else call the system resume routine
Sasha Levin
maintainerQuoted 34 lines · On Fri, Feb 07, 2020 at 09:53:47AM +0100, [email protected] wrote:
The patch below does not apply to the 5.5-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From
410e5e55c9c1c9c0d452ac5b9adb37b933a7747eMon Sep 17 00:00:00 2001
From: Pierre-Louis Bossart <[email protected]>
Date: Fri, 24 Jan 2020 15:36:21 -0600
Subject: [PATCH] ASoC: SOF: core: release resources on errors inprobe_continueThe initial intent of releasing resources in the .remove does not work well with HDaudio codecs. If the
probe_continue()fails in a work queue, e.g. due to missing firmware or authentication issues, we don't release any resources, and as a result the kernel oopses during suspend operations.The suggested fix is to release all resources during errors in
probe_continue(), and usefw_stateto track resource allocation state, so that .remove does not attempt to release the same hardware resources twice. PM operations are also modified so that no action is done if DSP resources have been freed due to an error at probe.Reported-by Takashi Iwai <[email protected]>Co-developed-by Kai Vehmanen <[email protected]>Signed-off-by Kai Vehmanen <[email protected]>
Quoted 6 lines
Bugzilla: http://bugzilla.suse.com/show_bug.cgi?id=1161246
Signed-off-by Pierre-Louis Bossart <[email protected]>Reviewed-by Takashi Iwai <[email protected]>Signed-off-by Mark Brown <[email protected]>
Conflict due to missing 285880a23d10 ("ASoC: SOF: Make creation of machine device from SOF core optional") and a "random" space added in this commit. Cleaned up and queued for 5.5 and 5.4.
Signature · 2 lines
Thanks, Sasha