* [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements
@ 2023-05-12 10:33 Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 1/3] ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions Peter Ujfalusi
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-05-12 10:33 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, pierre-louis.bossart, ranjani.sridharan, kai.vehmanen,
daniel.baluta
Three patch to correct error path PM runtime handling in few places.
Regards,
Peter
---
Pierre-Louis Bossart (3):
ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions
ASoC: SOF: pcm: fix pm_runtime imbalance in error handling
ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error
handling
sound/soc/sof/debug.c | 4 ++--
sound/soc/sof/pcm.c | 11 ++++++-----
sound/soc/sof/sof-client-probes.c | 14 ++++++++------
3 files changed, 16 insertions(+), 13 deletions(-)
--
2.40.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/3] ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions
2023-05-12 10:33 [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Peter Ujfalusi
@ 2023-05-12 10:33 ` Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 2/3] ASoC: SOF: pcm: fix pm_runtime imbalance in error handling Peter Ujfalusi
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-05-12 10:33 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, pierre-louis.bossart, ranjani.sridharan, kai.vehmanen,
daniel.baluta
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
When a firmware IPC error happens during a pm_runtime suspend, we
ignore the error and suspend anyways. However, the code
unconditionally increases the runtime_pm counter. This results in a
confusing configuration where the code will suspend, resume but never
suspend again due to the use of pm_runtime_get_noresume().
The intent of the counter increase was to prevent entry in D3, but if
that transition to D3 is already started it cannot be stopped. In
addition, there's no point in that case in trying to prevent anything,
the firmware error is handled and the next resume will re-initialize
the firmware completely.
This patch changes the logic to prevent suspend when the device is
pm_runtime active and has a use_count > 0.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/sof/debug.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c
index b42b5982cbbc..d547318e0d32 100644
--- a/sound/soc/sof/debug.c
+++ b/sound/soc/sof/debug.c
@@ -438,8 +438,8 @@ void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev, const char *msg)
/* should we prevent DSP entering D3 ? */
if (!sdev->ipc_dump_printed)
dev_info(sdev->dev,
- "preventing DSP entering D3 state to preserve context\n");
- pm_runtime_get_noresume(sdev->dev);
+ "Attempting to prevent DSP from entering D3 state to preserve context\n");
+ pm_runtime_get_if_in_use(sdev->dev);
}
/* dump vital information to the logs */
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/3] ASoC: SOF: pcm: fix pm_runtime imbalance in error handling
2023-05-12 10:33 [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 1/3] ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions Peter Ujfalusi
@ 2023-05-12 10:33 ` Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 3/3] ASoC: SOF: sof-client-probes: " Peter Ujfalusi
2023-05-15 11:09 ` [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-05-12 10:33 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, pierre-louis.bossart, ranjani.sridharan, kai.vehmanen,
daniel.baluta
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
When an error occurs, we need to make sure the device can pm_runtime
suspend instead of keeping it active.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/sof/pcm.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c
index 567db32173a8..d0ab6f390734 100644
--- a/sound/soc/sof/pcm.c
+++ b/sound/soc/sof/pcm.c
@@ -643,16 +643,17 @@ static int sof_pcm_probe(struct snd_soc_component *component)
"%s/%s",
plat_data->tplg_filename_prefix,
plat_data->tplg_filename);
- if (!tplg_filename)
- return -ENOMEM;
+ if (!tplg_filename) {
+ ret = -ENOMEM;
+ goto pm_error;
+ }
ret = snd_sof_load_topology(component, tplg_filename);
- if (ret < 0) {
+ if (ret < 0)
dev_err(component->dev, "error: failed to load DSP topology %d\n",
ret);
- return ret;
- }
+pm_error:
pm_runtime_mark_last_busy(component->dev);
pm_runtime_put_autosuspend(component->dev);
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 3/3] ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling
2023-05-12 10:33 [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 1/3] ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 2/3] ASoC: SOF: pcm: fix pm_runtime imbalance in error handling Peter Ujfalusi
@ 2023-05-12 10:33 ` Peter Ujfalusi
2023-05-15 11:09 ` [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Peter Ujfalusi @ 2023-05-12 10:33 UTC (permalink / raw)
To: lgirdwood, broonie
Cc: alsa-devel, pierre-louis.bossart, ranjani.sridharan, kai.vehmanen,
daniel.baluta
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
When an error occurs, we need to make sure the device can pm_runtime
suspend instead of keeping it active.
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
sound/soc/sof/sof-client-probes.c | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/sound/soc/sof/sof-client-probes.c b/sound/soc/sof/sof-client-probes.c
index fff126808bc0..8d9e9d5f40e4 100644
--- a/sound/soc/sof/sof-client-probes.c
+++ b/sound/soc/sof/sof-client-probes.c
@@ -218,12 +218,7 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
ret = ipc->points_info(cdev, &desc, &num_desc);
if (ret < 0)
- goto exit;
-
- pm_runtime_mark_last_busy(dev);
- err = pm_runtime_put_autosuspend(dev);
- if (err < 0)
- dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err);
+ goto pm_error;
for (i = 0; i < num_desc; i++) {
offset = strlen(buf);
@@ -241,6 +236,13 @@ static ssize_t sof_probes_dfs_points_read(struct file *file, char __user *to,
ret = simple_read_from_buffer(to, count, ppos, buf, strlen(buf));
kfree(desc);
+
+pm_error:
+ pm_runtime_mark_last_busy(dev);
+ err = pm_runtime_put_autosuspend(dev);
+ if (err < 0)
+ dev_err_ratelimited(dev, "debugfs read failed to idle %d\n", err);
+
exit:
kfree(buf);
return ret;
--
2.40.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements
2023-05-12 10:33 [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Peter Ujfalusi
` (2 preceding siblings ...)
2023-05-12 10:33 ` [PATCH 3/3] ASoC: SOF: sof-client-probes: " Peter Ujfalusi
@ 2023-05-15 11:09 ` Mark Brown
3 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2023-05-15 11:09 UTC (permalink / raw)
To: lgirdwood, Peter Ujfalusi
Cc: alsa-devel, pierre-louis.bossart, ranjani.sridharan, kai.vehmanen,
daniel.baluta
On Fri, 12 May 2023 13:33:12 +0300, Peter Ujfalusi wrote:
> Three patch to correct error path PM runtime handling in few places.
>
> Regards,
> Peter
>
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/3] ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions
commit: 3de975862f985f1c9e225a0d13aa3d501373f7c3
[2/3] ASoC: SOF: pcm: fix pm_runtime imbalance in error handling
commit: da0fe8fd515a471d373acc3682bfb5522cca4d55
[3/3] ASoC: SOF: sof-client-probes: fix pm_runtime imbalance in error handling
commit: bc424273c74c1565c459c8f2a6ed95caee368d0a
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] 5+ messages in thread
end of thread, other threads:[~2023-05-15 11:12 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-12 10:33 [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 1/3] ASoC: SOF: debug: conditionally bump runtime_pm counter on exceptions Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 2/3] ASoC: SOF: pcm: fix pm_runtime imbalance in error handling Peter Ujfalusi
2023-05-12 10:33 ` [PATCH 3/3] ASoC: SOF: sof-client-probes: " Peter Ujfalusi
2023-05-15 11:09 ` [PATCH 0/3] ASoC: SOF: Various runtime pm fixes, improvements Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox