From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] AMBA: Use suspend_noriq to force devices into runtime suspend
Date: Thu, 27 Oct 2011 20:48:32 +0100 [thread overview]
Message-ID: <20111027194832.GO19187@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <CAKnu2MpGOKFKpO=2mmu4a74gmbCUdO8Ui5+1nEB6GbfitGBLRw@mail.gmail.com>
On Thu, Oct 27, 2011 at 08:27:36PM +0200, Linus Walleij wrote:
> I think this patch is on top of that one. This moves the
> runtime_[suspend|resume] so as to put all the runtime PM stuff
> inside the same #ifdef block, then adds two new _noirq
> functions to address the problems from the named
> commit by Rafael.
I don't think it does address any problems mentioned by Rafael - the
referred to commit is about avoiding races between the system suspend
method and the runtime PM methods which is an entirely different
problem to ensuring that the bus clock is shutdown on suspend.
Ignoring runtime PM entirely, what this patch is doing is _adding_
management of the primecell bus clock to the bus layer and taking
control of that away from drivers. When I implemented the bus clock
support, it was based around the bus clock being enabled at probe
time, and only subsequently disabling it after the driver was
removed - all other management was left to the driver to manage as
appropriate.
That brings up the question whether there has been any check to
ensure that there are no drivers already managing the bus clock in
their suspend methods - if there are, this patch has the potential
to make the bus clock enable count to negative.
There's also the related point here that the behaviour that you get
for the bus clock from a system suspend depends on whether you have
runtime-PM configured or not - and that's a recipe for drivers being
scattered with ifdefs to 'undo' this variable semantic.
However, that's not the only problem - let's look closer at what is
being done in the patch.
The ordering on suspend is:
Enter amba_pm_suspend_noirq()
Call amba_pm_runtime_suspend_noirq()
If runtime PM is not suspended
Disable pclk
Call driver suspend_noirq method
Return
...
Enter amba_pm_resume_noirq()
If runtime PM is not suspended
Enable pclk
Call driver resume_noirq method
Call amba_pm_runtime_resume_noirq()
Return
This _can't_ be correct - we're potentially disabling the bus clock
and then calling the driver (which may try to access the registers)
which may cause a bus fault, a data abort and therefore a kernel oops.
That's really not nice and sane behaviour.
Also throw into the mix whether it's appropriate for the bus clock
to be turned off while the primecell is acting as a wakeup source -
can we safely say that it is legal and proper to disable the bus
clock for every primecell?
next prev parent reply other threads:[~2011-10-27 19:48 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-27 15:48 [PATCH] AMBA: Use suspend_noriq to force devices into runtime suspend Ulf Hansson
2011-10-27 15:54 ` Russell King - ARM Linux
2011-10-27 18:27 ` Linus Walleij
2011-10-27 19:48 ` Russell King - ARM Linux [this message]
2011-10-28 9:29 ` Ulf Hansson
2011-11-02 9:02 ` Russell King - ARM Linux
2011-11-02 10:55 ` Ulf Hansson
2011-11-02 12:51 ` Russell King - ARM Linux
2011-10-27 16:10 ` Alan Stern
2011-10-28 8:12 ` Ulf Hansson
2011-10-28 15:18 ` Alan Stern
2011-11-01 9:32 ` 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=20111027194832.GO19187@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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).