All of lore.kernel.org
 help / color / mirror / Atom feed
From: Preeti U Murthy <preeti@linux.vnet.ibm.com>
To: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: mingo@kernel.org, peterz@infradead.org, tglx@linutronix.de,
	rjw@rjwysocki.net, nicolas.pitre@linaro.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH V3 1/5] idle/cpuidle: Split cpuidle_idle_call main function into smaller functions
Date: Fri, 28 Feb 2014 17:31:40 +0530	[thread overview]
Message-ID: <53107AA4.30902@linux.vnet.ibm.com> (raw)
In-Reply-To: <1393315733-32321-1-git-send-email-daniel.lezcano@linaro.org>

On 02/25/2014 01:38 PM, Daniel Lezcano wrote:
> In order to allow better integration between the cpuidle framework and the
> scheduler, reducing the distance between these two sub-components will
> facilitate this integration by moving part of the cpuidle code in the idle
> task file and, because idle.c is in the sched directory, we have access to
> the scheduler's private structures.
> 
> This patch splits the cpuidle_idle_call main entry function into 3 calls
> to a newly added API:
>  1. select the idle state
>  2. enter the idle state
>  3. reflect the idle state
> 
> The cpuidle_idle_call calls these three functions to implement the main
> idle entry function.
> 
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> Acked-by: Nicolas Pitre <nico@linaro.org>
> ---
> 
> ChangeLog:
> 
> V3:
>     * moved broadcast timer outside of cpuidle_enter() as suggested by
>       Preeti U Murthy.
> 	https://lkml.org/lkml/2014/2/24/601
> V2: 
>     * splitted cpuidle_select error check into 'cpuidle_enabled' function
> 
> ---
>  drivers/cpuidle/cpuidle.c |   97 ++++++++++++++++++++++++++++++++++++----------
>  include/linux/cpuidle.h   |   19 +++++++++
>  2 files changed, 95 insertions(+), 21 deletions(-)
> 
> Index: cpuidle-next/drivers/cpuidle/cpuidle.c
> ===================================================================
> --- cpuidle-next.orig/drivers/cpuidle/cpuidle.c
> +++ cpuidle-next/drivers/cpuidle/cpuidle.c
> @@ -65,6 +65,26 @@ int cpuidle_play_dead(void)
>  }
> 
>  /**
> + * cpuidle_enabled - check if the cpuidle framework is ready
> + * @dev: cpuidle device for this cpu
> + * @drv: cpuidle driver for this cpu
> + *
> + * Return 0 on success, otherwise:
> + * -NODEV : the cpuidle framework is not available
> + * -EBUSY : the cpuidle framework is not initialized
> + */
> +int cpuidle_enabled(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> +{
> +	if (off || !initialized)
> +		return -ENODEV;
> +
> +	if (!drv || !dev || !dev->enabled)
> +		return -EBUSY;
> +
> +	return 0;
> +}
> +
> +/**
>   * cpuidle_enter_state - enter the state and update stats
>   * @dev: cpuidle device for this cpu
>   * @drv: cpuidle driver for this cpu
> @@ -108,6 +128,51 @@ int cpuidle_enter_state(struct cpuidle_d
>  }
> 
>  /**
> + * cpuidle_select - ask the cpuidle framework to choose an idle state
> + *
> + * @drv: the cpuidle driver
> + * @dev: the cpuidle device
> + *
> + * Returns the index of the idle state.
> + */
> +int cpuidle_select(struct cpuidle_driver *drv, struct cpuidle_device *dev)
> +{
> +	return cpuidle_curr_governor->select(drv, dev);
> +}
> +
> +/**
> + * cpuidle_enter - enter into the specified idle state
> + *
> + * @drv:   the cpuidle driver tied with the cpu
> + * @dev:   the cpuidle device
> + * @index: the index in the idle state table
> + *
> + * Returns the index in the idle state, < 0 in case of error.
> + * The error code depends on the backend driver
> + */
> +int cpuidle_enter(struct cpuidle_driver *drv, struct cpuidle_device *dev,
> +		  int index)
> +{
> +	if (cpuidle_state_is_coupled(dev, drv, index))
> +		return cpuidle_enter_state_coupled(dev, drv, index);
> +	return cpuidle_enter_state(dev, drv, index);
> +}
> +
> +/**
<snip>
> 
> -	if (cpuidle_state_is_coupled(dev, drv, next_state))
> -		entered_state = cpuidle_enter_state_coupled(dev, drv,
> -							    next_state);
> -	else
> -		entered_state = cpuidle_enter_state(dev, drv, next_state);
> +	entered_state = cpuidle_enter(drv, dev, next_state);

Wouldn't you need to check for return value on cpuidle_enter()?

Regards
Preeti U Murthy


  parent reply	other threads:[~2014-02-28 12:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-25  8:08 [PATCH V3 1/5] idle/cpuidle: Split cpuidle_idle_call main function into smaller functions Daniel Lezcano
2014-02-25  8:08 ` [PATCH V3 2/5] cpuidle/idle: Move the cpuidle_idle_call function to idle.c Daniel Lezcano
2014-02-25  8:08 ` [PATCH V3 3/5] idle: Reorganize the idle loop Daniel Lezcano
2014-02-25  8:08 ` [PATCH V3 4/5] idle: Move idle conditions in cpuidle_idle main function Daniel Lezcano
2014-02-25  8:08 ` [PATCH V3 5/5] idle: Add more comments to the code Daniel Lezcano
2014-02-28 12:01 ` Preeti U Murthy [this message]
2014-02-28 12:56 ` [PATCH V3 1/5] idle/cpuidle: Split cpuidle_idle_call main function into smaller functions Peter Zijlstra
2014-02-28 15:31   ` Daniel Lezcano
2014-03-03  7:48   ` [PATCH V4 " Daniel Lezcano
2014-03-03  7:48     ` [PATCH V4 2/5] cpuidle/idle: Move the cpuidle_idle_call function to idle.c Daniel Lezcano
2014-03-11 12:37       ` [tip:sched/idle] " tip-bot for Daniel Lezcano
2014-03-03  7:48     ` [PATCH V4 3/5] idle: Reorganize the idle loop Daniel Lezcano
2014-03-11 12:37       ` [tip:sched/idle] sched/idle: " tip-bot for Daniel Lezcano
2014-03-03  7:48     ` [PATCH V4 4/5] idle: Move idle conditions in cpuidle_idle main function Daniel Lezcano
2014-03-11 12:37       ` [tip:sched/idle] sched/idle: " tip-bot for Daniel Lezcano
2014-03-03  7:48     ` [PATCH V4 5/5] idle: Add more comments to the code Daniel Lezcano
2014-03-11 12:37       ` [tip:sched/idle] sched/idle: " tip-bot for Daniel Lezcano
2014-03-11 12:37     ` [tip:sched/idle] idle/cpuidle: Split cpuidle_idle_call main function into smaller functions tip-bot for 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=53107AA4.30902@linux.vnet.ibm.com \
    --to=preeti@linux.vnet.ibm.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=nicolas.pitre@linaro.org \
    --cc=peterz@infradead.org \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.