From: Ulf Hansson <ulf.hansson@linaro.org>
To: Sudeep Holla <sudeep.holla@arm.com>,
Lorenzo Pieralisi <Lorenzo.Pieralisi@arm.com>,
linux-pm@vger.kernel.org
Cc: Ulf Hansson <ulf.hansson@linaro.org>,
Vincent Guittot <vincent.guittot@linaro.org>,
Benjamin Gaignard <benjamin.gaignard@st.com>,
Stephen Boyd <sboyd@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
"Rafael J . Wysocki" <rjw@rjwysocki.net>,
Lina Iyer <ilina@codeaurora.org>,
Bjorn Andersson <bjorn.andersson@linaro.org>,
linux-arm-kernel@lists.infradead.org,
Lukasz Luba <lukasz.luba@arm.com>
Subject: [PATCH 1/2] PM / Domains: Enable locking for syscore devices for IRQ safe genpds
Date: Tue, 1 Sep 2020 10:27:06 +0200 [thread overview]
Message-ID: <20200901082707.106860-2-ulf.hansson@linaro.org> (raw)
In-Reply-To: <20200901082707.106860-1-ulf.hansson@linaro.org>
The genpd lock is currently not being used, while suspending/resuming
syscore devices through genpd. This because we need to avoid using a mutex
when running in the syscore phase.
However, the locking can be useful under special circumstances (as shown in
subsequent changes) and for a genpd having the flag GENPD_FLAG_IRQ_SAFE
set. Therefore, let's make use of the lock when it's possible.
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
drivers/base/power/domain.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 2cb5e04cf86c..55d99a36bf6b 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1342,18 +1342,27 @@ static void genpd_complete(struct device *dev)
static void genpd_syscore_switch(struct device *dev, bool suspend)
{
struct generic_pm_domain *genpd;
+ bool use_lock;
genpd = dev_to_genpd_safe(dev);
if (!genpd)
return;
+ use_lock = genpd_is_irq_safe(genpd);
+
+ if (use_lock)
+ genpd_lock(genpd);
+
if (suspend) {
genpd->suspended_count++;
- genpd_sync_power_off(genpd, false, 0);
+ genpd_sync_power_off(genpd, use_lock, 0);
} else {
- genpd_sync_power_on(genpd, false, 0);
+ genpd_sync_power_on(genpd, use_lock, 0);
genpd->suspended_count--;
}
+
+ if (use_lock)
+ genpd_unlock(genpd);
}
void pm_genpd_syscore_poweroff(struct device *dev)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-09-01 8:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-01 8:27 [PATCH 0/2] cpuidle: psci: Enable s2idle when using PSCI OSI Ulf Hansson
2020-09-01 8:27 ` Ulf Hansson [this message]
2020-09-01 8:27 ` [PATCH 2/2] cpuidle: psci: Enable s2idle when using OSI with the PM domain topology Ulf Hansson
2020-10-01 10:17 ` Sudeep Holla
2020-10-01 11:24 ` Rafael J. Wysocki
2020-10-01 11:32 ` Ulf Hansson
2020-10-01 11:44 ` Ulf Hansson
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=20200901082707.106860-2-ulf.hansson@linaro.org \
--to=ulf.hansson@linaro.org \
--cc=Lorenzo.Pieralisi@arm.com \
--cc=benjamin.gaignard@st.com \
--cc=bjorn.andersson@linaro.org \
--cc=daniel.lezcano@linaro.org \
--cc=ilina@codeaurora.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rjw@rjwysocki.net \
--cc=sboyd@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=vincent.guittot@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).