diff options
-rw-r--r-- | arch/powerpc/platforms/pseries/processor_idle.c | 36 |
1 files changed, 13 insertions, 23 deletions
diff --git a/arch/powerpc/platforms/pseries/processor_idle.c b/arch/powerpc/platforms/pseries/processor_idle.c index a32d56d1f854..45d00e5fe14d 100644 --- a/arch/powerpc/platforms/pseries/processor_idle.c +++ b/arch/powerpc/platforms/pseries/processor_idle.c | |||
@@ -59,32 +59,22 @@ static int snooze_loop(struct cpuidle_device *dev, | |||
59 | { | 59 | { |
60 | unsigned long in_purr; | 60 | unsigned long in_purr; |
61 | ktime_t kt_before; | 61 | ktime_t kt_before; |
62 | unsigned long start_snooze; | 62 | int cpu = dev->cpu; |
63 | long snooze = drv->states[0].target_residency; | ||
64 | 63 | ||
65 | idle_loop_prolog(&in_purr, &kt_before); | 64 | idle_loop_prolog(&in_purr, &kt_before); |
65 | local_irq_enable(); | ||
66 | set_thread_flag(TIF_POLLING_NRFLAG); | ||
66 | 67 | ||
67 | if (snooze) { | 68 | while ((!need_resched()) && cpu_online(cpu)) { |
68 | start_snooze = get_tb() + snooze * tb_ticks_per_usec; | 69 | ppc64_runlatch_off(); |
69 | local_irq_enable(); | 70 | HMT_low(); |
70 | set_thread_flag(TIF_POLLING_NRFLAG); | 71 | HMT_very_low(); |
71 | |||
72 | while ((snooze < 0) || (get_tb() < start_snooze)) { | ||
73 | if (need_resched() || cpu_is_offline(dev->cpu)) | ||
74 | goto out; | ||
75 | ppc64_runlatch_off(); | ||
76 | HMT_low(); | ||
77 | HMT_very_low(); | ||
78 | } | ||
79 | |||
80 | HMT_medium(); | ||
81 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
82 | smp_mb(); | ||
83 | local_irq_disable(); | ||
84 | } | 72 | } |
85 | 73 | ||
86 | out: | ||
87 | HMT_medium(); | 74 | HMT_medium(); |
75 | clear_thread_flag(TIF_POLLING_NRFLAG); | ||
76 | smp_mb(); | ||
77 | |||
88 | dev->last_residency = | 78 | dev->last_residency = |
89 | (int)idle_loop_epilog(in_purr, kt_before); | 79 | (int)idle_loop_epilog(in_purr, kt_before); |
90 | return index; | 80 | return index; |
@@ -165,8 +155,8 @@ static struct cpuidle_state dedicated_states[MAX_IDLE_STATE_COUNT] = { | |||
165 | .name = "CEDE", | 155 | .name = "CEDE", |
166 | .desc = "CEDE", | 156 | .desc = "CEDE", |
167 | .flags = CPUIDLE_FLAG_TIME_VALID, | 157 | .flags = CPUIDLE_FLAG_TIME_VALID, |
168 | .exit_latency = 1, | 158 | .exit_latency = 10, |
169 | .target_residency = 10, | 159 | .target_residency = 100, |
170 | .enter = &dedicated_cede_loop }, | 160 | .enter = &dedicated_cede_loop }, |
171 | }; | 161 | }; |
172 | 162 | ||
@@ -197,7 +187,7 @@ void update_smt_snooze_delay(int cpu, int residency) | |||
197 | dev->states_usage[1].disable = 1; | 187 | dev->states_usage[1].disable = 1; |
198 | } else | 188 | } else |
199 | if (drv) | 189 | if (drv) |
200 | drv->states[0].target_residency = residency; | 190 | drv->states[1].target_residency = residency; |
201 | } | 191 | } |
202 | 192 | ||
203 | static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n, | 193 | static int pseries_cpuidle_add_cpu_notifier(struct notifier_block *n, |