From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Doug Anderson <dianders@chromium.org>,
Heiko Stuebner <heiko@sntech.de>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Chris Zhong <zyw@rock-chips.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
Sonny Rao <sonnyrao@chromium.org>,
Dylan Reid <dgreid@chromium.org>,
"linux-pm@vger.kernel.org" <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] cpufreq: suspend cpufreq governors on shutdown
Date: Fri, 30 Jan 2015 01:14:12 +0100 [thread overview]
Message-ID: <1548953.lJ1trAVWhn@vostro.rjw.lan> (raw)
In-Reply-To: <CAKohpo=iEb19QGKUXJO1PURPjUkv1ZCeVFg-i+AFihi7Gmjf0Q@mail.gmail.com>
On Monday, December 29, 2014 09:45:42 AM Viresh Kumar wrote:
> On 24 December 2014 at 11:39, Doug Anderson <dianders@chromium.org> wrote:
> > We should stop cpufreq governors when we shut down the system. If we
> > don't do this, we can end up with this deadlock:
> >
> > 1. cpufreq governor may be running on a CPU other than CPU0.
> > 2. In machine_restart() we call smp_send_stop() which stops CPUs.
> > If one of these CPUs was actively running a cpufreq governor
> > then it may have the mutex / spinlock needed to access the main
> > PMIC in the system (perhaps over I2C)
> > 3. If a machine needs access to the main PMIC in order to shutdown
> > then it will never get it since the mutex was lost when the other
> > CPU stopped.
> > 4. We'll hang (possibly eventually hitting the hard lockup detector).
> >
> > Let's avoid the problem by stopping the cpufreq governor at shutdown,
> > which is a sensible thing to do anyway.
> >
> > Signed-off-by: Doug Anderson <dianders@chromium.org>
> > ---
> > Changes in v2:
> > - Add a comment about why we register
> > - Don't create cpufreq_shutdown() wrapper function
> >
> > drivers/cpufreq/cpufreq.c | 11 +++++++++++
> > 1 file changed, 11 insertions(+)
> >
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index a09a29c..33f3d65 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -27,6 +27,7 @@
> > #include <linux/mutex.h>
> > #include <linux/slab.h>
> > #include <linux/suspend.h>
> > +#include <linux/syscore_ops.h>
> > #include <linux/tick.h>
> > #include <trace/events/power.h>
> >
> > @@ -2550,6 +2551,14 @@ int cpufreq_unregister_driver(struct cpufreq_driver *driver)
> > }
> > EXPORT_SYMBOL_GPL(cpufreq_unregister_driver);
> >
> > +/*
> > + * Stop cpufreq at shutdown to make sure it isn't holding any locks
> > + * or mutexes when secondary CPUs are halted.
> > + */
> > +static struct syscore_ops cpufreq_syscore_ops = {
> > + .shutdown = cpufreq_suspend,
> > +};
> > +
> > static int __init cpufreq_core_init(void)
> > {
> > if (cpufreq_disabled())
> > @@ -2558,6 +2567,8 @@ static int __init cpufreq_core_init(void)
> > cpufreq_global_kobject = kobject_create();
> > BUG_ON(!cpufreq_global_kobject);
> >
> > + register_syscore_ops(&cpufreq_syscore_ops);
> > +
> > return 0;
> > }
> > core_initcall(cpufreq_core_init);
>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Queued up for 3.20, thanks!
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
prev parent reply other threads:[~2015-01-29 23:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-24 6:09 Doug Anderson
2014-12-29 4:15 ` Viresh Kumar
2015-01-30 0:14 ` Rafael J. Wysocki [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=1548953.lJ1trAVWhn@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=dgreid@chromium.org \
--cc=dianders@chromium.org \
--cc=dmitry.torokhov@gmail.com \
--cc=heiko@sntech.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=sonnyrao@chromium.org \
--cc=viresh.kumar@linaro.org \
--cc=zyw@rock-chips.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
all inboxes | Powered by JetHome®