From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: alsa-devel@alsa-project.org
Cc: "Cezary Rojewski" <cezary.rojewski@intel.com>,
"Kai Vehmanen" <kai.vehmanen@linux.intel.com>,
tiwai@suse.de, "open list" <linux-kernel@vger.kernel.org>,
"Takashi Iwai" <tiwai@suse.com>,
"Liam Girdwood" <lgirdwood@gmail.com>,
broonie@kernel.org,
"Ranjani Sridharan" <ranjani.sridharan@linux.intel.com>,
"Amadeusz Sławiński" <amadeuszx.slawinski@linux.intel.com>,
"Bard Liao" <yung-chuan.liao@linux.intel.com>
Subject: Re: [PATCH 03/11] ASoC: soc-component: use pm_runtime_resume_and_get()
Date: Fri, 17 Jun 2022 14:47:39 -0500 [thread overview]
Message-ID: <e993c4c7-a956-b669-f5b5-5d42c8b35f1e@linux.intel.com> (raw)
In-Reply-To: <20220616220427.136036-4-pierre-louis.bossart@linux.intel.com>
On 6/16/22 17:04, Pierre-Louis Bossart wrote:
> simplify the flow. No functionality change, except that on -EACCESS
> the reference count will be decreased.
This patch turns out to be incorrect and should not be merged.
I missed the fact that the component pm_runtime_put() will decrease the
reference count that is already decreased with
pm_runtime_resume_and_get() when pm_runtime is not enabled. This leads
to warnings:
snd-soc-dummy snd-soc-dummy: Runtime PM usage count underflow!
Unfortunately we missed those warnings during validation, that's not so
good.
pm_runtime_resume_and_get() really needs to be used ONLY when the
get/put are part of the same function and the reference count can be
checked. When the get/put are in different functions, it's asking for
trouble.
Also the check on -EACCES is problematic when the component is handled
by a framework, it's not clear if that can happen or not.
The rest of the patches follow the pattern get_sync/put and don't have a
problem.
Sorry for the noise.
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> ---
> sound/soc/soc-component.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index e12f8244242b9..cb92e002c38bc 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -1213,11 +1213,11 @@ int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd,
> int i;
>
> for_each_rtd_components(rtd, i, component) {
> - int ret = pm_runtime_get_sync(component->dev);
> - if (ret < 0 && ret != -EACCES) {
> - pm_runtime_put_noidle(component->dev);
> + int ret = pm_runtime_resume_and_get(component->dev);
> +
> + if (ret < 0 && ret != -EACCES)
> return soc_component_ret(component, ret);
> - }
> +
> /* mark stream if succeeded */
> soc_component_mark_push(component, stream, pm);
> }
next prev parent reply other threads:[~2022-06-17 19:48 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-16 22:04 [PATCH 00/11] ASoC: use pm_runtime_resume_and_get() when possible Pierre-Louis Bossart
2022-06-16 22:04 ` [PATCH 01/11] ASoC: Intel: catpt: use pm_runtime_resume_and_get() Pierre-Louis Bossart
2022-06-17 12:18 ` Cezary Rojewski
2022-06-16 22:04 ` [PATCH 02/11] ASoC: Intel: skylake: skl-pcm: " Pierre-Louis Bossart
2022-06-17 12:19 ` Cezary Rojewski
2022-06-16 22:04 ` [PATCH 03/11] ASoC: soc-component: " Pierre-Louis Bossart
2022-06-17 19:47 ` Pierre-Louis Bossart [this message]
2022-06-16 22:04 ` [PATCH 04/11] ASoC: wcd-mbhc-v2: " Pierre-Louis Bossart
2022-06-17 20:53 ` Srinivas Kandagatla
2022-06-16 22:04 ` [PATCH 05/11] ASoC: wsa881x: " Pierre-Louis Bossart
2022-06-17 20:52 ` Srinivas Kandagatla
2022-06-16 22:04 ` [PATCH 06/11] ASoC: rockchip: i2s_tdm: " Pierre-Louis Bossart
2022-06-16 22:04 ` [PATCH 07/11] ASoC: fsl: fsl_sai: " Pierre-Louis Bossart
2022-06-16 22:04 ` [PATCH 08/11] ASoC: img: img-i2s-out: " Pierre-Louis Bossart
2022-06-16 22:04 ` [PATCH 09/11] ASoC: rockchip: pdm: " Pierre-Louis Bossart
2022-06-16 22:04 ` [PATCH 10/11] ASoC: tas2552: " Pierre-Louis Bossart
2022-06-16 22:04 ` [PATCH 11/11] ASoC: ti: davinci-mcasp: " Pierre-Louis Bossart
2022-06-17 12:28 ` Péter Ujfalusi
2022-06-17 12:21 ` [PATCH 00/11] ASoC: use pm_runtime_resume_and_get() when possible Cezary Rojewski
2022-06-28 10:31 ` (subset) " Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e993c4c7-a956-b669-f5b5-5d42c8b35f1e@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=broonie@kernel.org \
--cc=cezary.rojewski@intel.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ranjani.sridharan@linux.intel.com \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox