From: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
To: Tony Lindgren <tony@atomide.com>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Sebastian Reichel <sebastian.reichel@collabora.com>
Subject: Re: [PATCH] PM: runtime: Fix unpaired parent child_count for force_resume
Date: Fri, 7 May 2021 16:23:49 +0300 [thread overview]
Message-ID: <8ee97450-a568-765f-77b8-d48a494f1da1@ideasonboard.com> (raw)
In-Reply-To: <20210505110915.6861-1-tony@atomide.com>
On 05/05/2021 14:09, Tony Lindgren wrote:
> As pm_runtime_need_not_resume() relies also on usage_count, it can return
> a different value in pm_runtime_force_suspend() compared to when called in
> pm_runtime_force_resume(). Different return values can happen if anything
> calls PM runtime functions in between, and causes the parent child_count
> to increase on every resume.
>
> So far I've seen the issue only for omapdrm that does complicated things
> with PM runtime calls during system suspend for legacy reasons:
>
> omap_atomic_commit_tail() for omapdrm.0
> dispc_runtime_get()
> wakes up 58000000.dss as it's the dispc parent
> dispc_runtime_resume()
> rpm_resume() increases parent child_count
> dispc_runtime_put() won't idle, PM runtime suspend blocked
> pm_runtime_force_suspend() for 58000000.dss, !pm_runtime_need_not_resume()
> __update_runtime_status()
> system suspended
> pm_runtime_force_resume() for 58000000.dss, pm_runtime_need_not_resume()
> pm_runtime_enable() only called because of pm_runtime_need_not_resume()
> omap_atomic_commit_tail() for omapdrm.0
> dispc_runtime_get()
> wakes up 58000000.dss as it's the dispc parent
> dispc_runtime_resume()
> rpm_resume() increases parent child_count
> dispc_runtime_put() won't idle, PM runtime suspend blocked
> ...
> rpm_suspend for 58000000.dss but parent child_count is now unbalanced
>
> Let's fix the issue by adding a flag for needs_force_resume and use it in
> pm_runtime_force_resume() instead of pm_runtime_need_not_resume().
>
> Additionally omapdrm system suspend could be simplified later on to avoid
> lots of unnecessary PM runtime calls and the complexity it adds. The
> driver can just use internal functions that are shared between the PM
> runtime and system suspend related functions.
>
> Fixes: 4918e1f87c5f ("PM / runtime: Rework pm_runtime_force_suspend/resume()")
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
> Cc: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
> ---
> drivers/base/power/runtime.c | 10 +++++++---
> include/linux/pm.h | 1 +
> 2 files changed, 8 insertions(+), 3 deletions(-)
Tested on DRA76 EVM, with and without HDMI plugged in. I can see DSS
shutting down properly by looking at the CM_DSS_DSS_CLKCTRL register.
Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Tomi
prev parent reply other threads:[~2021-05-07 13:23 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-05 11:09 [PATCH] PM: runtime: Fix unpaired parent child_count for force_resume Tony Lindgren
2021-05-07 12:03 ` Ulf Hansson
2021-05-10 17:16 ` Rafael J. Wysocki
2021-05-07 13:23 ` Tomi Valkeinen [this message]
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=8ee97450-a568-765f-77b8-d48a494f1da1@ideasonboard.com \
--to=tomi.valkeinen@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael.j.wysocki@intel.com \
--cc=sebastian.reichel@collabora.com \
--cc=tony@atomide.com \
--cc=ulf.hansson@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).