[Skiboot] [PATCH 3/5] cpu: idle notice if pm state changes
Nicholas Piggin
npiggin at gmail.com
Thu Sep 14 21:13:44 AEST 2017
The idle code checks pm_enabled once at entry, then not again
until the idle exit condition is met. Change this to check
each opportunity and change idle type if necessary.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
core/cpu.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/core/cpu.c b/core/cpu.c
index 2a95dff6..01001861 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -396,8 +396,11 @@ void cpu_idle_job(void)
smt_lowest();
/* Check for jobs again */
- while (!cpu_check_jobs(cpu))
+ while (!cpu_check_jobs(cpu)) {
+ if (pm_enabled)
+ break;
barrier();
+ }
smt_medium();
}
}
@@ -409,6 +412,7 @@ void cpu_idle_delay(unsigned long delay)
unsigned long min_pm = usecs_to_tb(10);
if (pm_enabled && delay > min_pm) {
+pm:
for (;;) {
if (delay >= 0x7fffffff)
delay = 0x7fffffff;
@@ -419,13 +423,23 @@ void cpu_idle_delay(unsigned long delay)
now = mftb();
if (tb_compare(now, end) == TB_AAFTERB)
break;
-
delay = end - now;
+ if (!(pm_enabled && delay > min_pm))
+ goto no_pm;
}
} else {
+no_pm:
smt_lowest();
- while (tb_compare(mftb(), end) != TB_AAFTERB)
- barrier();
+ for (;;) {
+ now = mftb();
+ if (tb_compare(now, end) == TB_AAFTERB)
+ break;
+ delay = end - now;
+ if (pm_enabled && delay > min_pm) {
+ smt_medium();
+ goto pm;
+ }
+ }
smt_medium();
}
}
--
2.13.3
More information about the Skiboot
mailing list