All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: SOF: loader: release_firmware() on load failure to avoid batching
@ 2021-09-16  8:50 Peter Ujfalusi
  2021-09-16 15:14 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Ujfalusi @ 2021-09-16  8:50 UTC (permalink / raw)
  To: lgirdwood, broonie, pierre-louis.bossart, marc.herbert
  Cc: guennadi.liakhovetski, alsa-devel, ranjani.sridharan, kai.vehmanen

From: Marc Herbert <marc.herbert@intel.com>

Invoke release_firmware() when the firmware fails to boot in
sof_probe_continue().

The request_firmware() framework must be informed of failures in
sof_probe_continue() otherwise its internal "batching"
feature (different from caching) cached the firmware image
forever. Attempts to correct the file in /lib/firmware/ were then
silently and confusingly ignored until the next reboot. Unloading the
drivers did not help because from their disconnected perspective the
firmware had failed so there was nothing to release.

Also leverage the new snd_sof_fw_unload() function to simplify the
snd_sof_device_remove() function.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/core.c   | 4 +---
 sound/soc/sof/loader.c | 2 ++
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c
index 6be4f159ee35..20082c0f2f39 100644
--- a/sound/soc/sof/core.c
+++ b/sound/soc/sof/core.c
@@ -370,7 +370,6 @@ int snd_sof_device_remove(struct device *dev)
 			dev_warn(dev, "error: %d failed to prepare DSP for device removal",
 				 ret);
 
-		snd_sof_fw_unload(sdev);
 		snd_sof_ipc_free(sdev);
 		snd_sof_free_debug(sdev);
 		snd_sof_free_trace(sdev);
@@ -393,8 +392,7 @@ int snd_sof_device_remove(struct device *dev)
 		snd_sof_remove(sdev);
 
 	/* release firmware */
-	release_firmware(pdata->fw);
-	pdata->fw = NULL;
+	snd_sof_fw_unload(sdev);
 
 	return 0;
 }
diff --git a/sound/soc/sof/loader.c b/sound/soc/sof/loader.c
index 2b38a77cd594..9c3f251a0dd0 100644
--- a/sound/soc/sof/loader.c
+++ b/sound/soc/sof/loader.c
@@ -880,5 +880,7 @@ EXPORT_SYMBOL(snd_sof_run_firmware);
 void snd_sof_fw_unload(struct snd_sof_dev *sdev)
 {
 	/* TODO: support module unloading at runtime */
+	release_firmware(sdev->pdata->fw);
+	sdev->pdata->fw = NULL;
 }
 EXPORT_SYMBOL(snd_sof_fw_unload);
-- 
2.33.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: SOF: loader: release_firmware() on load failure to avoid batching
  2021-09-16  8:50 [PATCH] ASoC: SOF: loader: release_firmware() on load failure to avoid batching Peter Ujfalusi
@ 2021-09-16 15:14 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2021-09-16 15:14 UTC (permalink / raw)
  To: pierre-louis.bossart, marc.herbert, Peter Ujfalusi, lgirdwood
  Cc: guennadi.liakhovetski, alsa-devel, Mark Brown, ranjani.sridharan,
	kai.vehmanen

On Thu, 16 Sep 2021 11:50:08 +0300, Peter Ujfalusi wrote:
> From: Marc Herbert <marc.herbert@intel.com>
> 
> Invoke release_firmware() when the firmware fails to boot in
> sof_probe_continue().
> 
> The request_firmware() framework must be informed of failures in
> sof_probe_continue() otherwise its internal "batching"
> feature (different from caching) cached the firmware image
> forever. Attempts to correct the file in /lib/firmware/ were then
> silently and confusingly ignored until the next reboot. Unloading the
> drivers did not help because from their disconnected perspective the
> firmware had failed so there was nothing to release.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: SOF: loader: release_firmware() on load failure to avoid batching
      commit: 8a8e1813ffc35111fc0b6db49968ceb0e1615ced

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-09-16 15:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16  8:50 [PATCH] ASoC: SOF: loader: release_firmware() on load failure to avoid batching Peter Ujfalusi
2021-09-16 15:14 ` Mark Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.