[Skiboot] [PATCH 04/16] core/cpu: do not inline cpu_relax

Nicholas Piggin npiggin at gmail.com
Tue Jan 8 01:04:16 AEDT 2019


The added nops now push it up in size, and -Os uninlines it for every
compilation unit that calls it more than once, so it's much better to
just uninline.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
 core/cpu.c    | 12 ++++++++++++
 include/cpu.h | 12 +-----------
 2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/core/cpu.c b/core/cpu.c
index c27bff920..5d933bf5c 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -91,6 +91,18 @@ unsigned long __attrconst cpu_emergency_stack_top(unsigned int pir)
 		NORMAL_STACK_SIZE + EMERGENCY_STACK_SIZE - STACK_TOP_GAP;
 }
 
+void __nomcount cpu_relax(void)
+{
+	/* Relax a bit to give sibling threads some breathing space */
+	smt_lowest();
+	asm volatile("nop; nop; nop; nop;\n"
+		     "nop; nop; nop; nop;\n"
+		     "nop; nop; nop; nop;\n"
+		     "nop; nop; nop; nop;\n");
+	smt_medium();
+	barrier();
+}
+
 static void cpu_wake(struct cpu_thread *cpu)
 {
 	/* Is it idle ? If not, no need to wake */
diff --git a/include/cpu.h b/include/cpu.h
index 851fb8e80..06d5c0d11 100644
--- a/include/cpu.h
+++ b/include/cpu.h
@@ -142,17 +142,7 @@ extern unsigned int cpu_thread_count;
 /* Boot CPU. */
 extern struct cpu_thread *boot_cpu;
 
-static inline void __nomcount cpu_relax(void)
-{
-	/* Relax a bit to give sibling threads some breathing space */
-	smt_lowest();
-	asm volatile("nop; nop; nop; nop;\n"
-		     "nop; nop; nop; nop;\n"
-		     "nop; nop; nop; nop;\n"
-		     "nop; nop; nop; nop;\n");
-	smt_medium();
-	barrier();
-}
+extern void __nomcount cpu_relax(void);
 
 /* Initialize CPUs */
 void pre_init_boot_cpu(void);
-- 
2.18.0



More information about the Skiboot mailing list