public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yong Wang <yong.y.wang@linux.intel.com>
To: Ai Li <aili@codeaurora.org>
Cc: akpm@linux-foundation.org, dwalker@codeaurora.org,
	arjan@linux.intel.com, mingo@elte.hu, shemminger@vyatta.com,
	czoccolo@gmail.com, len.brown@intel.com, h.peter.anvin@intel.com,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-pm@lists.linux-foundation.org
Subject: Re: [PATCH v3] cpuidle: extend cpuidle and menu governor to handle dynamic states
Date: Thu, 16 Dec 2010 14:33:22 +0800	[thread overview]
Message-ID: <20101216063322.GA18025@ywang-moblin2.bj.intel.com> (raw)
In-Reply-To: <1280504951-27812-1-git-send-email-aili@codeaurora.org>

On Fri, Jul 30, 2010 at 09:49:11AM -0600, Ai Li wrote:
> On some SoC chips, HW resources may be in use during any particular idle
> period.  As a consequence, the cpuidle states that the SoC is safe to
> enter can change from idle period to idle period.  In addition, the
> latency and threshold of each cpuidle state can vary, depending on the
> operating condition when the CPU becomes idle, e.g. the current cpu
> frequency, the current state of the HW blocks, etc.
> 
> cpuidle core and the menu governor, in the current form, are geared
> towards cpuidle states that are static, i.e. the availabiltiy of the
> states, their latencies, their thresholds are non-changing during run
> time.  cpuidle does not provide any hook that cpuidle drivers can use
> to adjust those values on the fly for the current idle period before the
> menu governor selects the target cpuidle state.
> 
> This patch extends cpuidle core and the menu governor to handle states
> that are dynamic.  There are three additions in the patch and the patch
> maintains backwards-compatibility with existing cpuidle drivers.
> 
> 1) add prepare() to struct cpuidle_device.  A cpuidle driver can hook
> into the callback and cpuidle will call prepare() before calling the
> governor's select function.  The callback gives the cpuidle driver a
> chance to update the dynamic information of the cpuidle states for the
> current idle period, e.g. state availability, latencies, thresholds,
> power values, etc.
> 

Could you please point me to some sample code regarding how to use this
'prepare' callback?

> +
> +	/*
> +	 * Call the device's prepare function before calling the
> +	 * governor's select function.  ->prepare gives the device's
> +	 * cpuidle driver a chance to update any dynamic information
> +	 * of its cpuidle states for the current idle period, e.g.
> +	 * state availability, latencies, residencies, etc.
> +	 */
> +	if (dev->prepare)
> +		dev->prepare(dev);
> +
>  	/* ask the governor for the next state */
>  	next_state = cpuidle_curr_governor->select(dev);

In terms of dynamic states, what if situation changes between the
'prepare' callback and the selected state is actually entered? Like a
particular state makes sense when 'prepare' is called but does not make
sense any more when cpuidle actually tries to enter that state?

Thanks
-Yong


      reply	other threads:[~2010-12-16  6:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-30 15:49 [PATCH v3] cpuidle: extend cpuidle and menu governor to handle dynamic states Ai Li
2010-12-16  6:33 ` Yong Wang [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=20101216063322.GA18025@ywang-moblin2.bj.intel.com \
    --to=yong.y.wang@linux.intel.com \
    --cc=aili@codeaurora.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@linux.intel.com \
    --cc=czoccolo@gmail.com \
    --cc=dwalker@codeaurora.org \
    --cc=h.peter.anvin@intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@lists.linux-foundation.org \
    --cc=mingo@elte.hu \
    --cc=shemminger@vyatta.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