All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@codeaurora.org>
To: Lina Iyer <lina.iyer@linaro.org>
Cc: ulf.hansson@linaro.org, khilman@kernel.org, rjw@rjwysocki.net,
	linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	geert@linux-m68k.org, k.kozlowski@samsung.com,
	msivasub@codeaurora.org, agross@codeaurora.org,
	linux-arm-msm@vger.kernel.org, lorenzo.pieralisi@arm.com,
	ahaslam@baylibre.com, mtitinger@baylibre.com,
	Daniel Lezcano <daniel.lezcano@linaro.org>
Subject: Re: [RFC v2 04/12] ARM: cpuidle: Add runtime PM support for CPUs
Date: Fri, 26 Feb 2016 10:24:19 -0800	[thread overview]
Message-ID: <20160226182419.GV28849@codeaurora.org> (raw)
In-Reply-To: <1455310238-8963-5-git-send-email-lina.iyer@linaro.org>

On 02/12, Lina Iyer wrote:
> @@ -45,6 +48,8 @@ static int arm_enter_idle_state(struct cpuidle_device *dev,
>  
>  	ret = cpu_pm_enter();
>  	if (!ret) {
> +		RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev));

Can you add a comment on why we need to use RCU_NONIDLE here?
It's not super obvious.

> +
>  		/*
>  		 * Pass idle state index to cpu_suspend which in turn will
>  		 * call the CPU ops suspend protocol with idle index as a
> @@ -52,6 +57,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev,
>  		 */
>  		arm_cpuidle_suspend(idx);
>  
> +		RCU_NONIDLE(pm_runtime_get_sync(cpu_dev));
>  		cpu_pm_exit();
>  	}
>  
> @@ -84,6 +90,30 @@ static const struct of_device_id arm_idle_state_match[] __initconst = {
>  	{ },
>  };
>  
> +#ifdef CONFIG_HOTPLUG_CPU
> +static int cpu_hotplug(struct notifier_block *nb,

This function is pretty generically named. Maybe something more
runtime PM specific or cpu idle specific?

> +			unsigned long action, void *data)
> +{
> +	struct device *cpu_dev = get_cpu_device(smp_processor_id());
> +
> +	/* Execute CPU runtime PM on that CPU */
> +	switch (action) {

We could do the & ~CPU_TASKS_FROZEN trick here to save a few cases.

> +	case CPU_DYING:
> +	case CPU_DYING_FROZEN:
> +		RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev));

And do we actually need to use it for hotplug path? These
notifiers don't run from idle context do they?

> +		break;
> +	case CPU_STARTING:
> +	case CPU_STARTING_FROZEN:
> +		RCU_NONIDLE(pm_runtime_get_sync(cpu_dev));
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return NOTIFY_OK;
> +}
> +#endif
> +
>  /*
>   * arm_idle_init
>   *
> @@ -96,6 +126,7 @@ static int __init arm_idle_init(void)
>  	int cpu, ret;
>  	struct cpuidle_driver *drv = &arm_idle_driver;
>  	struct cpuidle_device *dev;
> +	struct device *cpu_dev;
>  
>  	/*
>  	 * Initialize idle states data, starting at index 1.
> @@ -148,10 +189,17 @@ static int __init arm_idle_init(void)
>  		}
>  	}
>  
> +#ifdef CONFIG_HOTPLUG_CPU
> +	/* Register for hotplug notifications for runtime PM */
> +	hotcpu_notifier(cpu_hotplug, 0);

Define an empty cpu_hotplug() function for !CONFIG_HOTPLUG_CPU
and then always call this without the ifdef?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

WARNING: multiple messages have this Message-ID (diff)
From: sboyd@codeaurora.org (Stephen Boyd)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC v2 04/12] ARM: cpuidle: Add runtime PM support for CPUs
Date: Fri, 26 Feb 2016 10:24:19 -0800	[thread overview]
Message-ID: <20160226182419.GV28849@codeaurora.org> (raw)
In-Reply-To: <1455310238-8963-5-git-send-email-lina.iyer@linaro.org>

On 02/12, Lina Iyer wrote:
> @@ -45,6 +48,8 @@ static int arm_enter_idle_state(struct cpuidle_device *dev,
>  
>  	ret = cpu_pm_enter();
>  	if (!ret) {
> +		RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev));

Can you add a comment on why we need to use RCU_NONIDLE here?
It's not super obvious.

> +
>  		/*
>  		 * Pass idle state index to cpu_suspend which in turn will
>  		 * call the CPU ops suspend protocol with idle index as a
> @@ -52,6 +57,7 @@ static int arm_enter_idle_state(struct cpuidle_device *dev,
>  		 */
>  		arm_cpuidle_suspend(idx);
>  
> +		RCU_NONIDLE(pm_runtime_get_sync(cpu_dev));
>  		cpu_pm_exit();
>  	}
>  
> @@ -84,6 +90,30 @@ static const struct of_device_id arm_idle_state_match[] __initconst = {
>  	{ },
>  };
>  
> +#ifdef CONFIG_HOTPLUG_CPU
> +static int cpu_hotplug(struct notifier_block *nb,

This function is pretty generically named. Maybe something more
runtime PM specific or cpu idle specific?

> +			unsigned long action, void *data)
> +{
> +	struct device *cpu_dev = get_cpu_device(smp_processor_id());
> +
> +	/* Execute CPU runtime PM on that CPU */
> +	switch (action) {

We could do the & ~CPU_TASKS_FROZEN trick here to save a few cases.

> +	case CPU_DYING:
> +	case CPU_DYING_FROZEN:
> +		RCU_NONIDLE(pm_runtime_put_sync_suspend(cpu_dev));

And do we actually need to use it for hotplug path? These
notifiers don't run from idle context do they?

> +		break;
> +	case CPU_STARTING:
> +	case CPU_STARTING_FROZEN:
> +		RCU_NONIDLE(pm_runtime_get_sync(cpu_dev));
> +		break;
> +	default:
> +		break;
> +	}
> +
> +	return NOTIFY_OK;
> +}
> +#endif
> +
>  /*
>   * arm_idle_init
>   *
> @@ -96,6 +126,7 @@ static int __init arm_idle_init(void)
>  	int cpu, ret;
>  	struct cpuidle_driver *drv = &arm_idle_driver;
>  	struct cpuidle_device *dev;
> +	struct device *cpu_dev;
>  
>  	/*
>  	 * Initialize idle states data, starting at index 1.
> @@ -148,10 +189,17 @@ static int __init arm_idle_init(void)
>  		}
>  	}
>  
> +#ifdef CONFIG_HOTPLUG_CPU
> +	/* Register for hotplug notifications for runtime PM */
> +	hotcpu_notifier(cpu_hotplug, 0);

Define an empty cpu_hotplug() function for !CONFIG_HOTPLUG_CPU
and then always call this without the ifdef?

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

  reply	other threads:[~2016-02-26 18:24 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-12 20:50 [RFC v2 00/12] PM: SoC idle support using PM domains Lina Iyer
2016-02-12 20:50 ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 01/12] PM / Domains: Abstract genpd locking Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 18:08   ` Stephen Boyd
2016-02-26 18:08     ` Stephen Boyd
2016-03-01 16:55     ` Lina Iyer
2016-03-01 16:55       ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 02/12] PM / Domains: Support IRQ safe PM domains Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 18:17   ` Stephen Boyd
2016-02-26 18:17     ` Stephen Boyd
2016-03-01 17:44     ` Lina Iyer
2016-03-01 17:44       ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 03/12] PM / cpu_domains: Setup PM domains for CPUs/clusters Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-17 23:38   ` Lina Iyer
2016-02-17 23:38     ` Lina Iyer
2016-02-18 17:29   ` [BUG FIX] PM / cpu_domains: Check for NULL callbacks Lina Iyer
2016-02-18 17:29     ` Lina Iyer
2016-02-18 17:46     ` Rafael J. Wysocki
2016-02-18 17:46       ` Rafael J. Wysocki
2016-02-18 22:51       ` Lina Iyer
2016-02-18 22:51         ` Lina Iyer
2016-02-26 19:10   ` [RFC v2 03/12] PM / cpu_domains: Setup PM domains for CPUs/clusters Stephen Boyd
2016-02-26 19:10     ` Stephen Boyd
2016-03-01 18:00     ` Lina Iyer
2016-03-01 18:00       ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 04/12] ARM: cpuidle: Add runtime PM support for CPUs Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 18:24   ` Stephen Boyd [this message]
2016-02-26 18:24     ` Stephen Boyd
2016-03-01 18:36     ` Lina Iyer
2016-03-01 18:36       ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 05/12] timer: Export next wake up of a CPU Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 06/12] PM / cpu_domains: Record CPUs that are part of the domain Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 19:20   ` Stephen Boyd
2016-02-26 19:20     ` Stephen Boyd
2016-03-01 19:24     ` Lina Iyer
2016-03-01 19:24       ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 07/12] PM / cpu_domains: Add PM Domain governor for CPUs Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 19:33   ` Stephen Boyd
2016-02-26 19:33     ` Stephen Boyd
2016-03-01 19:32     ` Lina Iyer
2016-03-01 19:32       ` Lina Iyer
2016-03-01 19:35       ` Stephen Boyd
2016-03-01 19:35         ` Stephen Boyd
2016-02-12 20:50 ` [RFC v2 08/12] Documentation / cpu_domains: Describe CPU PM domains setup and governor Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 19:43   ` Stephen Boyd
2016-02-26 19:43     ` Stephen Boyd
2016-03-01 19:36     ` Lina Iyer
2016-03-01 19:36       ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 09/12] drivers: firmware: psci: Allow OS Initiated suspend mode Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 10/12] ARM64: psci: Support cluster idle states for OS-Initiated Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 11/12] ARM64: dts: Add PSCI cpuidle support for MSM8916 Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-12 20:50 ` [RFC v2 12/12] ARM64: dts: Define CPU power domain " Lina Iyer
2016-02-12 20:50   ` Lina Iyer
2016-02-26 19:50   ` Stephen Boyd
2016-02-26 19:50     ` Stephen Boyd
2016-03-01 19:41     ` Lina Iyer
2016-03-01 19:41       ` Lina Iyer

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=20160226182419.GV28849@codeaurora.org \
    --to=sboyd@codeaurora.org \
    --cc=agross@codeaurora.org \
    --cc=ahaslam@baylibre.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=geert@linux-m68k.org \
    --cc=k.kozlowski@samsung.com \
    --cc=khilman@kernel.org \
    --cc=lina.iyer@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=msivasub@codeaurora.org \
    --cc=mtitinger@baylibre.com \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.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 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.