From 30fe6884021b9fa0124609e898a6341be188eb44 Mon Sep 17 00:00:00 2001 From: Sandeep Tripathy Date: Wed, 2 Jul 2014 15:00:58 +0530 Subject: [PATCH 1/7] cpuidle: move idle traces to cpuidle_enter_state() idle_exit event is the first event after a core exits idle state. So this should be traced before local irq is ebabled. Likewise idle_entry is the last event before a core enters idle state. This will ease visualising the cpu idle state from kernel traces. Signed-off-by: Sandeep Tripathy Acked-by: Daniel Lezcano [rjw: Subject, rebase] Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/cpuidle.c | 2 ++ kernel/sched/idle.c | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/cpuidle/cpuidle.c b/drivers/cpuidle/cpuidle.c index cb7019977c50..ee9df5e3f5eb 100644 --- a/drivers/cpuidle/cpuidle.c +++ b/drivers/cpuidle/cpuidle.c @@ -119,11 +119,13 @@ int cpuidle_enter_state(struct cpuidle_device *dev, struct cpuidle_driver *drv, ktime_t time_start, time_end; s64 diff; + trace_cpu_idle_rcuidle(index, dev->cpu); time_start = ktime_get(); entered_state = target_state->enter(dev, drv, index); time_end = ktime_get(); + trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); if (!cpuidle_state_is_coupled(dev, drv, entered_state)) local_irq_enable(); diff --git a/kernel/sched/idle.c b/kernel/sched/idle.c index cf009fb0bc25..658a58dc30f4 100644 --- a/kernel/sched/idle.c +++ b/kernel/sched/idle.c @@ -147,8 +147,6 @@ use_default: clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_ENTER, &dev->cpu)) goto use_default; - trace_cpu_idle_rcuidle(next_state, dev->cpu); - /* * Enter the idle state previously returned by the governor decision. * This function will block until an interrupt occurs and will take @@ -156,8 +154,6 @@ use_default: */ entered_state = cpuidle_enter(drv, dev, next_state); - trace_cpu_idle_rcuidle(PWR_EVENT_EXIT, dev->cpu); - if (broadcast) clockevents_notify(CLOCK_EVT_NOTIFY_BROADCAST_EXIT, &dev->cpu); From 4f8eea9b9ff464ce93ab10d72993755b7d86d587 Mon Sep 17 00:00:00 2001 From: Mohammad Merajul Islam Molla Date: Sat, 12 Jul 2014 19:29:22 +0600 Subject: [PATCH 2/7] cpuidle: fix permission for driver name sysfs node cpuidle driver name sysfs node is read-only, so permissions should be 0444. Signed-off-by: Mohammad Merajul Islam Molla Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/sysfs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/sysfs.c b/drivers/cpuidle/sysfs.c index efe2f175168f..97c5903b4606 100644 --- a/drivers/cpuidle/sysfs.c +++ b/drivers/cpuidle/sysfs.c @@ -445,7 +445,7 @@ static void cpuidle_remove_state_sysfs(struct cpuidle_device *device) #define define_one_driver_ro(_name, show) \ static struct cpuidle_driver_attr attr_driver_##_name = \ - __ATTR(_name, 0644, show, NULL) + __ATTR(_name, 0444, show, NULL) struct cpuidle_driver_kobj { struct cpuidle_driver *drv; From 8804ed155a5276cfbb7115493570b6874c89a12b Mon Sep 17 00:00:00 2001 From: Mohammad Merajul Islam Molla Date: Thu, 24 Jul 2014 21:02:01 +0600 Subject: [PATCH 3/7] cpuidle: menu governor - remove unused macro STDDEV_THRESH STDDEV_THRESH was once defined and used in menu governor. But now its no longer used anywhere. So removing the define. Signed-off-by: Mohammad Merajul Islam Molla Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/menu.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/cpuidle/governors/menu.c b/drivers/cpuidle/governors/menu.c index c4f80c15a48d..c3732fa74f82 100644 --- a/drivers/cpuidle/governors/menu.c +++ b/drivers/cpuidle/governors/menu.c @@ -35,7 +35,6 @@ #define RESOLUTION 1024 #define DECAY 8 #define MAX_INTERESTING 50000 -#define STDDEV_THRESH 400 /* From 6ee7f5dd57fc2e0450d0a41ec1320c06425335e0 Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 28 Jul 2014 10:28:59 +0530 Subject: [PATCH 4/7] cpuidle: big_little: Fix build error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit big_little CPU idle driver references functions defined in MCPM driver. Thus make it depend on MCPM to avoid the following errors: drivers/built-in.o: In function `bl_enter_powerdown': drivers/cpuidle/cpuidle-big_little.c:134: undefined reference to `mcpm_cpu_powered_up' drivers/built-in.o: In function `bl_powerdown_finisher': drivers/cpuidle/cpuidle-big_little.c:104: undefined reference to `mcpm_set_entry_vector' drivers/cpuidle/cpuidle-big_little.c:111: undefined reference to `mcpm_cpu_suspend' make: *** [vmlinux] Error 1 Reported-by: Andreas Färber Signed-off-by: Sachin Kamat Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/Kconfig.arm | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index b6d69e899f5d..a186dec8e5df 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -10,6 +10,7 @@ config ARM_ARMADA_370_XP_CPUIDLE config ARM_BIG_LITTLE_CPUIDLE bool "Support for ARM big.LITTLE processors" depends on ARCH_VEXPRESS_TC2_PM + depends on MCPM select ARM_CPU_SUSPEND select CPU_IDLE_MULTIPLE_DRIVERS help From 1469244613dadeccc563982b3246500913e26d61 Mon Sep 17 00:00:00 2001 From: Mohammad Merajul Islam Molla Date: Mon, 28 Jul 2014 09:58:50 +0600 Subject: [PATCH 5/7] cpuidle: ladder governor - use macro instead of hardcoded value use CPUIDLE_DRIVER_STATE_START, instead of hardcoded value 0. As, CPUIDLE_DRIVER_STATE_START can be 1/0 based on CONFIG_ARCH_HAS_CPU_RELAX is defined or not. Signed-off-by: Mohammad Merajul Islam Molla Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/governors/ladder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/cpuidle/governors/ladder.c b/drivers/cpuidle/governors/ladder.c index 9f08e8cce1af..044ee0df5871 100644 --- a/drivers/cpuidle/governors/ladder.c +++ b/drivers/cpuidle/governors/ladder.c @@ -144,7 +144,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv, ldev->last_state_idx = CPUIDLE_DRIVER_STATE_START; - for (i = 0; i < drv->state_count; i++) { + for (i = CPUIDLE_DRIVER_STATE_START; i < drv->state_count; i++) { state = &drv->states[i]; lstate = &ldev->states[i]; @@ -156,7 +156,7 @@ static int ladder_enable_device(struct cpuidle_driver *drv, if (i < drv->state_count - 1) lstate->threshold.promotion_time = state->exit_latency; - if (i > 0) + if (i > CPUIDLE_DRIVER_STATE_START) lstate->threshold.demotion_time = state->exit_latency; } From 3a4a267ee3d8f3f26ca76982a1e37fd8d783c1cd Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 23 Jul 2014 19:02:47 +0200 Subject: [PATCH 6/7] cpuidle: Remove manual selection of the multiple driver support Like the coupled idle state, it is not up to the user to set this option but the driver to select it. Remove the interactive selection of this option. Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/Kconfig | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/cpuidle/Kconfig b/drivers/cpuidle/Kconfig index 1b96fb91d32c..32748c36c477 100644 --- a/drivers/cpuidle/Kconfig +++ b/drivers/cpuidle/Kconfig @@ -15,12 +15,7 @@ config CPU_IDLE if CPU_IDLE config CPU_IDLE_MULTIPLE_DRIVERS - bool "Support multiple cpuidle drivers" - default n - help - Allows the cpuidle framework to use different drivers for each CPU. - This is useful if you have a system with different CPU latencies and - states. If unsure say N. + bool config CPU_IDLE_GOV_LADDER bool "Ladder governor (for periodic timer tick)" From dd38c9d35ba8e40011b36659cae2719aefd11904 Mon Sep 17 00:00:00 2001 From: Daniel Lezcano Date: Wed, 23 Jul 2014 19:02:48 +0200 Subject: [PATCH 7/7] cpuidle: Remove time measurement in poll state The time measurement is already done in the cpuidle framework in the 'cpuidle_enter_state' function. Signed-off-by: Daniel Lezcano Signed-off-by: Rafael J. Wysocki --- drivers/cpuidle/driver.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c index 9634f20e3926..e431d11abf8d 100644 --- a/drivers/cpuidle/driver.c +++ b/drivers/cpuidle/driver.c @@ -182,10 +182,6 @@ static void __cpuidle_driver_init(struct cpuidle_driver *drv) static int poll_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - ktime_t t1, t2; - s64 diff; - - t1 = ktime_get(); local_irq_enable(); if (!current_set_polling_and_test()) { while (!need_resched()) @@ -193,13 +189,6 @@ static int poll_idle(struct cpuidle_device *dev, } current_clr_polling(); - t2 = ktime_get(); - diff = ktime_to_us(ktime_sub(t2, t1)); - if (diff > INT_MAX) - diff = INT_MAX; - - dev->last_residency = (int) diff; - return index; }