linux-acpi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rob Lee <rob.lee-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
To: Colin Cross <ccross-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org,
	khilman-l0cyMroinI0@public.gmane.org,
	kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org,
	magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	arnd.bergmann-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org,
	linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	nsekhar-l0cyMroinI0@public.gmane.org,
	s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org,
	Baohua.Song-kQvG35nSl+M@public.gmane.org,
	linux-PelNFVqkFnVyf+4FbqDuWQ@public.gmane.org,
	deepthi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org,
	broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org
Subject: Re: [RFC PATCH v4 1/4] cpuidle: Add time keeping and irq enabling
Date: Mon, 6 Feb 2012 11:14:55 -0600	[thread overview]
Message-ID: <CAMXH7KG4bfH=tbLmniZZVegyphY_p8q27NAtoo5PHjUCG+ULRg@mail.gmail.com> (raw)
In-Reply-To: <CAMbhsRQxgvRN0skteFxeDBqmUArTa3wu2uZPqowDnBTSWuqScg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hello Colin, thanks for the review.

On Sat, Feb 4, 2012 at 1:02 PM, Colin Cross <ccross-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> wrote:
> On Tue, Jan 31, 2012 at 7:00 PM, Robert Lee <rob.lee-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
>> Make necessary changes to add implement time keepign and irq enabling
> keeping
>> in the core cpuidle code.  This will allow the remove of these
>> functionalities from the platform cpuidle implementations.
>>
>> Signed-off-by: Robert Lee <rob.lee-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
>> ---
>>  drivers/cpuidle/cpuidle.c |   75 +++++++++++++++++++++++++++++++++++---------
>>  include/linux/cpuidle.h   |   26 ++++++++++-----
>>  2 files changed, 76 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c
>> index 59f4261..8ea0fc3 100644
>> --- a/drivers/cpuidle/cpuidle.c
>> +++ b/drivers/cpuidle/cpuidle.c
>> @@ -57,14 +57,18 @@ static int __cpuidle_register_device(struct cpuidle_device *dev);
>>  * cpuidle_idle_call - the main idle loop
>>  *
>>  * NOTE: no locks or semaphores should be used here
>> + * NOTE: Should only be called from a local irq disabled context
>>  * return non-zero on failure
>> + *
>>  */
>>  int cpuidle_idle_call(void)
>>  {
>>        struct cpuidle_device *dev = __this_cpu_read(cpuidle_devices);
>>        struct cpuidle_driver *drv = cpuidle_get_driver();
>>        struct cpuidle_state *target_state;
>> -       int next_state, entered_state;
>> +       int idx, ret = 0;
>> +       ktime_t t1, t2;
>> +       s64 diff;
>>
>>        if (off)
>>                return -ENODEV;
>> @@ -86,37 +90,76 @@ int cpuidle_idle_call(void)
>>  #endif
>>
>>        /* ask the governor for the next state */
>> -       next_state = cpuidle_curr_governor->select(drv, dev);
>> +       idx = cpuidle_curr_governor->select(drv, dev);
>> +
>> +       target_state = &drv->states[idx];
>> +
>> +       /*
>> +        * Check with the device to see if it can enter this state or if another
>> +        * state should be used.
>> +        */
>> +       if (target_state->pre_enter) {
>> +               idx = target_state->
>> +                       pre_enter(dev, drv, idx);
> Unnecessary line wrap and braces.

Thanks.

>
> What's the point of the pre_enter call?  This seems very similar to
> the prepare call that was removed in 3.2.  Drivers can already demote
> the target state in their enter call.  The only thing you do between
> pre_enter and enter is trace and account for the time.  Is there some
> long call you don't want included in the idle time?  Some
> documentation would help, and you need to very clearly define the
> semantics of when post_enter gets called when pre_enter or enter
> return errors.

pre_enter's purpose is to perform any necessary platform technology
that can be performed before entering that actual idle or some
restricted idle context where only platform specific code can run.  If
I try to consolidate the timekeeping in the core cpuidle driver
without pre_enter, then my idle time will incorrectly account for this
platform preparation time.  Perhaps this small idle time accounting
error isn't of concern to anyone though.

The previous version of this patch submission used a different
approach by adding a wrapper that could be used by fairly simple
cpuidle implementations.  In the v3 submission of this patch series,
Daniel asked about the possibility of just performing this
consolidation in the cpuidle_idle_call function itself.  Instead of
debating the pros and cons of it, I thought it might be better to send
this version of the patch and discuss it further.

Another approach I thought about may be to add flags that indicate
whether or not the platform or the core driver should perform the time
keeping.  Or, go back to the wrapper function approach.  Please feel
free to give your opinion on the preferred approach.

Agree on the documentation.  I was trying to just get this patch
series out there for discussion before spending more time on it in
case it is not the desired approach to timekeeping and irq disabling
consolidation.

  parent reply	other threads:[~2012-02-06 17:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-01  3:00 [RFC PATCH v4 0/4] Consolidate cpuidle timekeeping and irq enabling Robert Lee
2012-02-01  3:00 ` [RFC PATCH v4 1/4] cpuidle: Add time keeping " Robert Lee
2012-02-04 19:02   ` Colin Cross
2012-02-04 22:06     ` Turquette, Mike
2012-02-05  1:36       ` Colin Cross
     [not found]         ` <CAMbhsRR2Zsv7d+_iganMhz5WxDiUYd-zOCoVehz4yjzyH2q+wA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-05  1:48           ` Turquette, Mike
2012-02-06 16:38       ` Rob Lee
     [not found]     ` <CAMbhsRQxgvRN0skteFxeDBqmUArTa3wu2uZPqowDnBTSWuqScg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-02-06 17:14       ` Rob Lee [this message]
2012-02-01  3:00 ` [RFC PATCH v4 2/4] ARM: omap: Remove cpuidle timekeeping and irq enable/disable Robert Lee
     [not found]   ` <1328065215-28108-3-git-send-email-rob.lee-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-02-02 16:21     ` Jean Pihet
2012-02-02 17:35       ` Rob Lee
2012-02-01  3:00 ` [RFC PATCH v4 3/4] acpi: " Robert Lee
2012-02-01  3:00 ` [RFC PATCH v4 4/4] x86: " Robert Lee
2012-02-10 19:32 ` [RFC PATCH v4 0/4] Consolidate cpuidle timekeeping and irq enabling Rob Lee
2012-02-10 20:06   ` Amit Kucheria
2012-02-22 20:52   ` Colin Cross
2012-02-23  6:39     ` Rob Lee

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='CAMXH7KG4bfH=tbLmniZZVegyphY_p8q27NAtoo5PHjUCG+ULRg@mail.gmail.com' \
    --to=rob.lee-qsej5fyqhm4dnm+yrofe0a@public.gmane.org \
    --cc=Baohua.Song-kQvG35nSl+M@public.gmane.org \
    --cc=arnd.bergmann-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org \
    --cc=ccross-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=deepthi-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
    --cc=kgene.kim-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org \
    --cc=khilman-l0cyMroinI0@public.gmane.org \
    --cc=len.brown-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=linaro-dev-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-PelNFVqkFnVyf+4FbqDuWQ@public.gmane.org \
    --cc=linux-acpi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-lFZ/pmaqli7XmaaqVzeoHQ@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=nicolas.pitre-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=nsekhar-l0cyMroinI0@public.gmane.org \
    --cc=patches-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=s.hauer-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.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).