Message ID | 1349691856-30590-1-git-send-email-josephl@nvidia.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 10/08/2012 04:24 AM, Joseph Lo wrote: > The Tegra CPU idle LP3 state is doing ARM WFI only. So it's same with > the common ARM_CPUIDLE_WFI_STATE. Using it to replace LP3 now. Hmm. This changes the exit_latency/target_residency fields of the cpuidle state definition from 10 to 1, and also replaces tegra_idle_enter_lp3() with just a dsb/wfi as far as I can tell. What are the implications of removing the irq/fiq_disable/enable and ktim-related code? It might be worth explaining why this change is valid in the commit description.
Hi Stephen, Thanks for your review. On Tue, 2012-10-09 at 00:19 +0800, Stephen Warren wrote: > On 10/08/2012 04:24 AM, Joseph Lo wrote: > > The Tegra CPU idle LP3 state is doing ARM WFI only. So it's same with > > the common ARM_CPUIDLE_WFI_STATE. Using it to replace LP3 now. > > Hmm. This changes the exit_latency/target_residency fields of the > cpuidle state definition from 10 to 1, and also replaces > tegra_idle_enter_lp3() with just a dsb/wfi as far as I can tell. What > are the implications of removing the irq/fiq_disable/enable and > ktim-related code? It might be worth explaining why this change is valid > in the commit description. > -- There were some histories about the latency. The legacy LP3 mode called to "tegra_cpu_wfi". This func was been removed. We called to "cpu_do_idle" right now. In the old "tegra_cpu_wfi", we did back up the current flow controller register and set up flow controller to CPU_WFE state. It did wait for CPU running to WFI and clock gate it externally. We need a time duration to make flow controller to do that. When any event or interrupt been triggered, it resume the CPU clock. And CPU runs after WFI and restore the flow controller. We found this may hurt performance, so we drop that. The latency is not true anymore. Now we just using WFI to enter low-power CPU standby state where most clocks gated. About the missing irq/fiq disable/enable call, we enable the "en_core_tk_irqen" in this patch. That means we enable time keeping and irq enabling in the core cpuidle code. So the cpuidle enter code will use the "cpuidle_wrap_enter" in "drivers/cpuidle/cpuidle.c". After merging these concepts, I think we can use the common ARM_CPUIDLE_WFI_STATE to replace the current LP3 code. Thanks, Joseph
On 10/08/2012 04:24 AM, Joseph Lo wrote: > The Tegra CPU idle LP3 state is doing ARM WFI only. So it's same with > the common ARM_CPUIDLE_WFI_STATE. Using it to replace LP3 now. Applied to Tegra's for-3.8/cpuidle branch (I created that branch in anticipation of there being a bunch of other cpuidle work for 3.8).
diff --git a/arch/arm/mach-tegra/cpuidle.c b/arch/arm/mach-tegra/cpuidle.c index 566e2f8..4e0b07c 100644 --- a/arch/arm/mach-tegra/cpuidle.c +++ b/arch/arm/mach-tegra/cpuidle.c @@ -23,60 +23,22 @@ #include <linux/kernel.h> #include <linux/module.h> -#include <linux/cpu.h> #include <linux/cpuidle.h> -#include <linux/hrtimer.h> -#include <asm/proc-fns.h> - -#include <mach/iomap.h> - -static int tegra_idle_enter_lp3(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index); +#include <asm/cpuidle.h> struct cpuidle_driver tegra_idle_driver = { .name = "tegra_idle", .owner = THIS_MODULE, + .en_core_tk_irqen = 1, .state_count = 1, .states = { - [0] = { - .enter = tegra_idle_enter_lp3, - .exit_latency = 10, - .target_residency = 10, - .power_usage = 600, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "LP3", - .desc = "CPU flow-controlled", - }, + [0] = ARM_CPUIDLE_WFI_STATE_PWR(600), }, }; static DEFINE_PER_CPU(struct cpuidle_device, tegra_idle_device); -static int tegra_idle_enter_lp3(struct cpuidle_device *dev, - struct cpuidle_driver *drv, int index) -{ - ktime_t enter, exit; - s64 us; - - local_irq_disable(); - local_fiq_disable(); - - enter = ktime_get(); - - cpu_do_idle(); - - exit = ktime_sub(ktime_get(), enter); - us = ktime_to_us(exit); - - local_fiq_enable(); - local_irq_enable(); - - dev->last_residency = us; - - return index; -} - static int __init tegra_cpuidle_init(void) { int ret;
The Tegra CPU idle LP3 state is doing ARM WFI only. So it's same with the common ARM_CPUIDLE_WFI_STATE. Using it to replace LP3 now. Signed-off-by: Joseph Lo <josephl@nvidia.com> --- arch/arm/mach-tegra/cpuidle.c | 44 ++-------------------------------------- 1 files changed, 3 insertions(+), 41 deletions(-)