diff options
author | Joel Stanley <joel@jms.id.au> | 2014-08-13 18:09:44 +1000 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2014-08-13 18:23:07 +1000 |
commit | bb8be0ec098a57796776b8a1d1fb49a220a539d8 (patch) | |
tree | 2fcfa1d238cfb11e2ec19db252938934c81bcf62 /core/timebase.c | |
parent | 52a920308d1850a85023e3b61678cf68c73593cc (diff) | |
download | skiboot-bb8be0ec098a57796776b8a1d1fb49a220a539d8.zip skiboot-bb8be0ec098a57796776b8a1d1fb49a220a539d8.tar.gz skiboot-bb8be0ec098a57796776b8a1d1fb49a220a539d8.tar.bz2 |
Add cpu_relax to stop cores spinning hard
Ensure a thread is not stopping its siblings from making forward
progress when we are busy-waiting on older DD1.x CPU revisions where
SMT priorities are somewhat broken.
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'core/timebase.c')
-rw-r--r-- | core/timebase.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/timebase.c b/core/timebase.c index bf378ed..fb46bcf 100644 --- a/core/timebase.c +++ b/core/timebase.c @@ -16,13 +16,17 @@ #include <timebase.h> #include <opal.h> +#include <cpu.h> void time_wait(unsigned long duration) { unsigned long end = mftb() + duration; - while(tb_compare(mftb(), end) != TB_AAFTERB) + while(tb_compare(mftb(), end) != TB_AAFTERB) { opal_run_pollers(); + cpu_relax(); + } + } void time_wait_nopoll(unsigned long duration) @@ -30,7 +34,7 @@ void time_wait_nopoll(unsigned long duration) unsigned long end = mftb() + duration; while(tb_compare(mftb(), end) != TB_AAFTERB) - ; + cpu_relax(); } void time_wait_ms(unsigned long ms) |