[Skiboot] [PATCH 14/34] console: Print CPU number on message lines in DEBUG builds

Benjamin Herrenschmidt benh at kernel.crashing.org
Sun Jul 24 09:27:08 AEST 2016


This is handy to check if farming work to other CPUs is actually
working as expected

Signed-off-by: Benjamin Herrenschmidt <benh at kernel.crashing.org>
---
 core/console-log.c | 10 ++++++++--
 core/cpu.c         |  3 +++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/core/console-log.c b/core/console-log.c
index 3b9475e..db05e39 100644
--- a/core/console-log.c
+++ b/core/console-log.c
@@ -26,6 +26,7 @@
 #include "stdio.h"
 #include "console.h"
 #include "timebase.h"
+#include "cpu.h"
 
 static int vprlog(int log_level, const char *fmt, va_list ap)
 {
@@ -43,8 +44,13 @@ static int vprlog(int log_level, const char *fmt, va_list ap)
 	if (log_level > (debug_descriptor.console_log_levels >> 4))
 		return 0;
 
-	count = snprintf(buffer, sizeof(buffer), "[%lu,%d] ",
-			 mftb(), log_level);
+#ifdef DEBUG
+	count = snprintf(buffer, sizeof(buffer), "[%lu,%d,%02x] ",
+			 mftb(), log_level, this_cpu()->pir);
+#else
+	count = snprintf(buffer, sizeof(buffer), "[%lu,%d,%02x] ",
+			 mftb(), log_level, this_cpu()->pir);
+#endif
 	count+= vsnprintf(buffer+count, sizeof(buffer)-count, fmt, ap);
 
 	if (log_level > (debug_descriptor.console_log_levels & 0x0f))
diff --git a/core/cpu.c b/core/cpu.c
index a3e96b1..47c39c1 100644
--- a/core/cpu.c
+++ b/core/cpu.c
@@ -443,6 +443,9 @@ void __nomcount pre_init_boot_cpu(void)
 	struct cpu_thread *cpu = this_cpu();
 
 	memset(cpu, 0, sizeof(struct cpu_thread));
+
+	/* For early messages */
+	cpu->pir = mfspr(SPR_PIR);
 }
 
 void init_boot_cpu(void)
-- 
2.7.4



More information about the Skiboot mailing list