From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Linux PM list <linux-pm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 2/2] cpuidle / menu: Return error code if there are no suitable states
Date: Tue, 29 Apr 2014 01:28:03 +0200 [thread overview]
Message-ID: <2000825.kO1es8ShkW@vostro.rjw.lan> (raw)
In-Reply-To: <535E3818.2040905@linaro.org>
On Monday, April 28, 2014 01:14:32 PM Daniel Lezcano wrote:
> On 04/27/2014 02:55 PM, Rafael J. Wysocki wrote:
> > From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> >
> > If there is a PM QoS latency limit and all of the sufficiently shallow
> > C-states are disabled, the cpuidle menu governor returns 0 which on
> > some systems is CPUIDLE_DRIVER_STATE_START and shouldn't be returned
> > if that C-state has been disabled.
> >
> > Fix the issue by modifying the menu governor to return an error code
> > in such situations.
> >
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > ---
> > drivers/cpuidle/governors/menu.c | 2 +-
> > include/linux/cpuidle.h | 2 ++
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > Index: linux-pm/drivers/cpuidle/governors/menu.c
> > ===================================================================
> > --- linux-pm.orig/drivers/cpuidle/governors/menu.c
> > +++ linux-pm/drivers/cpuidle/governors/menu.c
> > @@ -296,7 +296,7 @@ static int menu_select(struct cpuidle_dr
> > data->needs_update = 0;
> > }
> >
> > - data->last_state_idx = 0;
> > + data->last_state_idx = CPUIDLE_DRIVER_STATE_POLL;
> >
> > /* Special case when user has set very strict latency requirement */
> > if (unlikely(latency_req == 0))
> > Index: linux-pm/include/linux/cpuidle.h
> > ===================================================================
> > --- linux-pm.orig/include/linux/cpuidle.h
> > +++ linux-pm/include/linux/cpuidle.h
> > @@ -217,8 +217,10 @@ static inline int cpuidle_register_gover
> >
> > #ifdef CONFIG_ARCH_HAS_CPU_RELAX
> > #define CPUIDLE_DRIVER_STATE_START 1
> > +#define CPUIDLE_DRIVER_STATE_POLL 0
> > #else
> > #define CPUIDLE_DRIVER_STATE_START 0
> > +#define CPUIDLE_DRIVER_STATE_POLL (-ENXIO)
> > #endif
> >
> > #endif /* _LINUX_CPUIDLE_H */
>
> Hi Rafael,
>
> CPUIDLE_DRIVER_STATE_START is only for x86. It introduces some confusion
> in the code.
I won't disagree with that.
> As only two drivers are concerned by it, wouldn't make
> sense to add the poll state to those driver directly instead of having
> the code hacked around ? (eg. insert the poll state in the common
> cpuidle code).
Well, what about initializing data->last_state_idx to
(CPUIDLE_DRIVER_STATE_START - 1) in menu_select() instead of introducing the
new symbol for the time being and getting rid of CPUIDLE_DRIVER_STATE_START
separately?
--
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
next prev parent reply other threads:[~2014-04-28 23:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-27 12:53 [PATCH 0/2] cpuidle: Avoid returning a disabled C-state from menu governor Rafael J. Wysocki
2014-04-27 12:54 ` [PATCH 1/2] cpuidle: Combine cpuidle_enabled() with cpuidle_select() Rafael J. Wysocki
2014-04-27 12:55 ` [PATCH 2/2] cpuidle / menu: Return error code if there are no suitable states Rafael J. Wysocki
2014-04-28 11:14 ` Daniel Lezcano
2014-04-28 23:28 ` Rafael J. Wysocki [this message]
2014-04-29 23:16 ` Rafael J. Wysocki
2014-05-02 8:47 ` Daniel Lezcano
2014-05-02 12:20 ` Rafael J. Wysocki
2014-05-02 13:19 ` Daniel Lezcano
2014-05-04 22:39 ` Rafael J. Wysocki
2014-04-30 12:40 ` Daniel Lezcano
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=2000825.kO1es8ShkW@vostro.rjw.lan \
--to=rjw@rjwysocki.net \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@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
all inboxes | Powered by JetHome®