From 9b9058fe0f99f74a3d2ecc076a166ad7b37f2f40 Mon Sep 17 00:00:00 2001 From: Deepthi Dharwar Date: Wed, 3 Oct 2012 18:42:18 +0000 Subject: [PATCH] --- yaml --- r: 334480 b: refs/heads/master c: 8ea959a17fe6e27f7954dddad5b17b0e33f0d7ee h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/arch/powerpc/include/asm/processor.h | 4 ++-- trunk/arch/powerpc/kernel/sysfs.c | 2 +- .../platforms/pseries/processor_idle.c | 24 +++++++++++++------ 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index b3ec2413e770..4ef29c31a931 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 817deb05df45577d4037230f2facee486c11d9df +refs/heads/master: 8ea959a17fe6e27f7954dddad5b17b0e33f0d7ee diff --git a/trunk/arch/powerpc/include/asm/processor.h b/trunk/arch/powerpc/include/asm/processor.h index 8734b3855272..87502046c0dc 100644 --- a/trunk/arch/powerpc/include/asm/processor.h +++ b/trunk/arch/powerpc/include/asm/processor.h @@ -388,9 +388,9 @@ extern int powersave_nap; /* set if nap mode can be used in idle loop */ extern void power7_nap(void); #ifdef CONFIG_PSERIES_IDLE -extern void update_smt_snooze_delay(int snooze); +extern void update_smt_snooze_delay(int cpu, int residency); #else -static inline void update_smt_snooze_delay(int snooze) {} +static inline void update_smt_snooze_delay(int cpu, int residency) {} #endif extern void flush_instruction_cache(void); diff --git a/trunk/arch/powerpc/kernel/sysfs.c b/trunk/arch/powerpc/kernel/sysfs.c index 8302af649219..cf357a059ddb 100644 --- a/trunk/arch/powerpc/kernel/sysfs.c +++ b/trunk/arch/powerpc/kernel/sysfs.c @@ -50,7 +50,7 @@ static ssize_t store_smt_snooze_delay(struct device *dev, return -EINVAL; per_cpu(smt_snooze_delay, cpu->dev.id) = snooze; - update_smt_snooze_delay(snooze); + update_smt_snooze_delay(cpu->dev.id, snooze); return count; } diff --git a/trunk/arch/powerpc/platforms/pseries/processor_idle.c b/trunk/arch/powerpc/platforms/pseries/processor_idle.c index 02e425aa2af8..a32d56d1f854 100644 --- a/trunk/arch/powerpc/platforms/pseries/processor_idle.c +++ b/trunk/arch/powerpc/platforms/pseries/processor_idle.c @@ -33,13 +33,6 @@ static int max_idle_state = MAX_IDLE_STATE_COUNT - 1; static struct cpuidle_device __percpu *pseries_cpuidle_devices; static struct cpuidle_state *cpuidle_state_table; -void update_smt_snooze_delay(int snooze) -{ - struct cpuidle_driver *drv = cpuidle_get_driver(); - if (drv) - drv->states[0].target_residency = snooze; -} - static inline void idle_loop_prolog(unsigned long *in_purr, ktime_t *kt_before) { @@ -190,6 +183,23 @@ static struct cpuidle_state shared_states[MAX_IDLE_STATE_COUNT] = { .enter = &shared_cede_loop }, }; +void update_smt_snooze_delay(int cpu, int residency) +{ + struct cpuidle_driver *drv = cpuidle_get_driver(); + struct cpuidle_device *dev = per_cpu(cpuidle_devices, cpu); + + if (cpuidle_state_table != dedicated_states) + return; + + if (residency < 0) { + /* Disable the Nap state on that cpu */ + if (dev) + dev->states_usage[1].disable = 1; + } else + if (drv) + drv->states[0].target_residency = residency; +} + static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n, unsigned long action, void *hcpu) {