aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-10-08 13:22:40 +1100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-10-08 13:22:40 +1100
commit1712d88806859fd46d06118c6450f0a66812c91b (patch)
tree55636ead8eeef03fb693137112b8e2e2d5f75416
parent10fb2e543b666ec92f57068daf2c2d9b151c6ba2 (diff)
downloadskiboot-1712d88806859fd46d06118c6450f0a66812c91b.zip
skiboot-1712d88806859fd46d06118c6450f0a66812c91b.tar.gz
skiboot-1712d88806859fd46d06118c6450f0a66812c91b.tar.bz2
core: Make secondary spin and locks use cpu_relax()
This makes secondaries spinning waiting for a job and spinlocks use cpu_relax() which speeds up the primary thread and thus speeds up the boot process a bit. Also prettify a bit cpu_relax() implementation Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--core/cpu.c9
-rw-r--r--core/init.c3
-rw-r--r--core/lock.c3
3 files changed, 6 insertions, 9 deletions
diff --git a/core/cpu.c b/core/cpu.c
index cefb1f0..f962d7c 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -67,11 +67,10 @@ void cpu_relax(void)
/* Relax a bit to give sibling threads some breathing space */
smt_low();
smt_very_low();
- asm volatile("nop; nop; nop\n");
- asm volatile("nop; nop; nop\n");
- asm volatile("nop; nop; nop\n");
- asm volatile("nop; nop; nop\n");
- asm volatile("nop; nop; nop\n");
+ asm volatile("nop; nop; nop; nop\n");
+ asm volatile("nop; nop; nop; nop\n");
+ asm volatile("nop; nop; nop; nop\n");
+ asm volatile("nop; nop; nop; nop\n");
smt_medium();
}
diff --git a/core/init.c b/core/init.c
index 99d17f1..a1d6f44 100644
--- a/core/init.c
+++ b/core/init.c
@@ -673,8 +673,7 @@ void __noreturn __secondary_cpu_entry(void)
/* Relax a bit to give the simulator some breathing space */
i = 1000;
while (--i)
- smt_very_low();
- smt_low();
+ cpu_relax();
}
}
diff --git a/core/lock.c b/core/lock.c
index 70fb994..6a8282f 100644
--- a/core/lock.c
+++ b/core/lock.c
@@ -87,9 +87,8 @@ void lock(struct lock *l)
for (;;) {
if (try_lock(l))
break;
- smt_low();
+ cpu_relax();
}
- smt_medium();
}
void unlock(struct lock *l)