diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2017-09-14 21:13:44 +1000 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-09-28 00:30:02 -0500 |
commit | 210cb11e02cb77c060dbecb50e1aa185913e1e1d (patch) | |
tree | b323452895b8d35a2a14689b4275736072d47b82 | |
parent | 65d5f68fc7f5f00cd9045246e407c85785df2ed6 (diff) | |
download | skiboot-210cb11e02cb77c060dbecb50e1aa185913e1e1d.zip skiboot-210cb11e02cb77c060dbecb50e1aa185913e1e1d.tar.gz skiboot-210cb11e02cb77c060dbecb50e1aa185913e1e1d.tar.bz2 |
cpu: idle notice if pm state changes
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@gmail.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | core/cpu.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -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(); } } |