[Skiboot] [PATCH 1/4] cpu: Introduce smt_lowest()
Nicholas Piggin
npiggin at gmail.com
Mon May 22 15:53:00 AEST 2017
Recent CPUs have introduced a lower SMT priority. This uses the
Linux pattern of executing priority nops in descending order to
get a simple portable way to put the CPU into lowest SMT priority.
Introduce smt_lowest() and use it in place of smt_very_low and
smt_low ; smt_very_low sequences.
Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
asm/head.S | 6 +++---
core/cpu.c | 2 +-
core/fast-reboot.c | 6 +++---
include/cpu.h | 3 +--
include/processor.h | 2 ++
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/asm/head.S b/asm/head.S
index a2dcb8cd..8e33f229 100644
--- a/asm/head.S
+++ b/asm/head.S
@@ -398,7 +398,7 @@ secondary_wait:
*/
LOAD_IMM32(%r3, boot_flag - __head)
add %r3,%r3,%r30
-1: smt_very_low
+1: smt_lowest
lwz %r0,0(%r3)
cmpdi %r0,0
beq 1b
@@ -416,7 +416,7 @@ secondary_wait:
1:
/* Now wait for cpu_secondary_start to be set */
LOAD_ADDR_FROM_TOC(%r3, cpu_secondary_start)
-1: smt_very_low
+1: smt_lowest
ld %r0,0(%r3)
cmpdi %r0,0
beq 1b
@@ -441,7 +441,7 @@ secondary_wait:
/* Not found... what to do ? set some global error ? */
secondary_not_found:
- smt_very_low
+ smt_lowest
b .
call_relocate:
diff --git a/core/cpu.c b/core/cpu.c
index c7e650da..a03cf916 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -871,7 +871,7 @@ void cpu_bringup(void)
/* Add a callin timeout ? If so, call cpu_remove_node(t). */
while (t->state != cpu_state_active) {
- smt_very_low();
+ smt_lowest();
sync();
}
smt_medium();
diff --git a/core/fast-reboot.c b/core/fast-reboot.c
index 41e87e34..b99eb998 100644
--- a/core/fast-reboot.c
+++ b/core/fast-reboot.c
@@ -488,7 +488,7 @@ void __noreturn fast_reboot_entry(void)
if (this_cpu() != boot_cpu) {
this_cpu()->state = cpu_state_present;
while (!fast_boot_release) {
- smt_very_low();
+ smt_lowest();
sync();
}
smt_medium();
@@ -511,7 +511,7 @@ void __noreturn fast_reboot_entry(void)
/* XXX Add a callin timeout ? */
while (cpu->state != cpu_state_present) {
- smt_very_low();
+ smt_lowest();
sync();
}
smt_medium();
@@ -534,7 +534,7 @@ void __noreturn fast_reboot_entry(void)
/* XXX Add a callin timeout ? */
while (cpu->state == cpu_state_present) {
- smt_very_low();
+ smt_lowest();
sync();
}
}
diff --git a/include/cpu.h b/include/cpu.h
index 1e147aa8..938492e3 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -121,8 +121,7 @@ extern struct cpu_thread *boot_cpu;
static inline void __nomcount cpu_relax(void)
{
/* Relax a bit to give sibling threads some breathing space */
- smt_low();
- smt_very_low();
+ smt_lowest();
asm volatile("nop; nop; nop; nop;\n"
"nop; nop; nop; nop;\n"
"nop; nop; nop; nop;\n"
diff --git a/include/processor.h b/include/processor.h
index b98dff8d..5906b865 100644
--- a/include/processor.h
+++ b/include/processor.h
@@ -197,6 +197,7 @@
#define smt_medium_low or 6,6,6
#define smt_extra_high or 7,7,7
#define smt_very_low or 31,31,31
+#define smt_lowest smt_low ; smt_very_low
#else /* __ASSEMBLY__ */
@@ -214,6 +215,7 @@ static inline void smt_medium_high(void){ asm volatile("or 5,5,5"); }
static inline void smt_medium_low(void) { asm volatile("or 6,6,6"); }
static inline void smt_extra_high(void) { asm volatile("or 7,7,7"); }
static inline void smt_very_low(void) { asm volatile("or 31,31,31"); }
+static inline void smt_lowest(void) { smt_low(); smt_very_low(); }
/*
* SPR access functions
--
2.11.0
More information about the Skiboot
mailing list