From: Krzysztof Kozlowski <k.kozlowski@samsung.com>
To: Ulf Hansson <ulf.hansson@linaro.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
Russell King <linux@arm.linux.org.uk>,
Dan Williams <dan.j.williams@intel.com>,
Vinod Koul <vinod.koul@intel.com>,
Alan Stern <stern@rowland.harvard.edu>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
dmaengine@vger.kernel.org, Kevin Hilman <khilman@kernel.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Subject: Re: [PATCH v11 5/6] dmaengine: pl330: Add PM sleep support
Date: Wed, 12 Nov 2014 16:53:32 +0100 [thread overview]
Message-ID: <1415807612.20177.6.camel@AMDC1943> (raw)
In-Reply-To: <CAPDyKFoBdq0Vdh-RELGMX_oud2PaDofqBHgc-ViReYwP9-=y2w@mail.gmail.com>
On śro, 2014-11-12 at 16:28 +0100, Ulf Hansson wrote:
> On 12 November 2014 15:32, Krzysztof Kozlowski <k.kozlowski@samsung.com> wrote:
> > Add system suspend/resume capabilities to the pl330 driver so the amba
> > bus clock could be also unprepared to conserve energy.
> >
> > Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
> > ---
> > drivers/dma/pl330.c | 37 +++++++++++++++++++++++++++++++++++++
> > 1 file changed, 37 insertions(+)
> >
> > diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> > index c3bd3584f261..fd71777fc565 100644
> > --- a/drivers/dma/pl330.c
> > +++ b/drivers/dma/pl330.c
> > @@ -2627,6 +2627,42 @@ static int pl330_dma_device_slave_caps(struct dma_chan *dchan,
> > return 0;
> > }
> >
> > +/*
> > + * Runtime PM callbacks are provided by amba/bus.c driver.
> > + *
> > + * It is assumed here that IRQ safe runtime PM is chosen in probe and amba
> > + * bus driver will only disable/enable the clock in runtime PM callbacks.
> > + */
> > +static int __maybe_unused pl330_suspend(struct device *dev)
> > +{
> > + struct amba_device *pcdev = to_amba_device(dev);
> > +
> > + if (!pm_runtime_status_suspended(dev)) {
>
> No, this wont work. Consider this scenario:
>
> pm_runtime_status_suspended() returns "true", which means you consider
> the device to be runtime PM suspended, thus you will unprepare the
> clock below.
>
> Later, a call to pm_runtime_get_sync() is invoked from "somewhere" and
> before this driver's system PM resume callback has been invoked. That
> will trigger the runtime PM resume callback to be invoked, causing
> clock unbalance issues.
If during system resume the device runtime resume is called BEFORE
normal resume of device, then you're right: clock will be unbalanced.
But such case does not make sense. pm_runtime_get_sync() is called when
someone wants to use the dmaengine/pl330... but the pl330 driver is
still suspended in that time!
If runtime resume is called AFTER normal resume of device - then it is
fine with my code.
> You need a pm_runtime_disable() prior checking the runtime PM status
> using pm_runtime_status_suspended(). That will prevent this from
> happen.
>
> I guess you may see where this is leading. I think
> pm_runtime_force_suspend|resume() is well suited for this situation.
I've been there... :)
next prev parent reply other threads:[~2014-11-12 15:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-12 14:32 [PATCH v11 0/6] amba/dmaengine: pl330: add Power Management support Krzysztof Kozlowski
2014-11-12 14:32 ` [PATCH v11 1/6] PM / Runtime: Add getter for querying the IRQ safe option Krzysztof Kozlowski
2014-11-13 1:34 ` Rafael J. Wysocki
2014-11-14 8:14 ` Krzysztof Kozlowski
2014-11-12 14:32 ` [PATCH v11 2/6] amba: Add helpers for (un)preparing AMBA clock Krzysztof Kozlowski
2014-11-12 14:32 ` [PATCH v11 3/6] amba: Don't unprepare the clocks if device driver wants IRQ safe runtime PM Krzysztof Kozlowski
2014-11-12 15:29 ` Ulf Hansson
2014-11-12 14:32 ` [PATCH v11 4/6] dmaengine: pl330: Add runtime Power Management support Krzysztof Kozlowski
2014-11-12 14:32 ` [PATCH v11 5/6] dmaengine: pl330: Add PM sleep support Krzysztof Kozlowski
2014-11-12 15:28 ` Ulf Hansson
2014-11-12 15:53 ` Krzysztof Kozlowski [this message]
2014-11-13 1:37 ` Rafael J. Wysocki
2014-11-13 9:03 ` Ulf Hansson
2014-11-14 8:13 ` Krzysztof Kozlowski
2014-11-12 14:32 ` [PATCH v11 6/6] amba: Use inlines instead of macros for amba_pclk_enable/disable Krzysztof Kozlowski
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=1415807612.20177.6.camel@AMDC1943 \
--to=k.kozlowski@samsung.com \
--cc=b.zolnierkie@samsung.com \
--cc=dan.j.williams@intel.com \
--cc=dmaengine@vger.kernel.org \
--cc=khilman@kernel.org \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.szyprowski@samsung.com \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
--cc=ulf.hansson@linaro.org \
--cc=vinod.koul@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 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.