[Skiboot] [PATCH 1/2] nvram: Print how long we waited for nvram

Oliver O'Halloran oohall at gmail.com
Mon Sep 17 17:53:15 AEST 2018


Print how long we had to wait for NVRAM to become available if we needed
to wait.

Signed-off-by: Oliver O'Halloran <oohall at gmail.com>
---
 core/nvram-format.c | 2 ++
 core/nvram.c        | 9 +++++++++
 2 files changed, 11 insertions(+)

diff --git a/core/nvram-format.c b/core/nvram-format.c
index 42c5cbbb9238..fc8e24820e5e 100644
--- a/core/nvram-format.c
+++ b/core/nvram-format.c
@@ -217,6 +217,8 @@ const char *nvram_query(const char *key)
 	const char *part_end, *start;
 	int key_len = strlen(key);
 
+	assert(key);
+
 	if (!nvram_has_loaded()) {
 		prlog(PR_WARNING, "NVRAM: Query before is done loading\n");
 		prlog(PR_WARNING, "NVRAM: Waiting for load\n");
diff --git a/core/nvram.c b/core/nvram.c
index c2158216a91b..8c68957cf136 100644
--- a/core/nvram.c
+++ b/core/nvram.c
@@ -21,6 +21,7 @@
 #include <device.h>
 #include <platform.h>
 #include <nvram.h>
+#include <timebase.h>
 
 static void *nvram_image;
 static uint32_t nvram_size;
@@ -126,6 +127,8 @@ void nvram_read_complete(bool success)
 
 bool nvram_wait_for_load(void)
 {
+	uint64_t started;
+
 	/* Short cut */
 	if (nvram_ready)
 		return true;
@@ -145,12 +148,18 @@ bool nvram_wait_for_load(void)
 		return false;
 	}
 
+	started = mftb();
+
 	while (!nvram_ready) {
 		opal_run_pollers();
 		/* If the read fails, tell the caller */
 		if (!nvram_image && !nvram_size)
 			return false;
 	}
+
+	prlog(PR_DEBUG, "NVRAM: Waited %lums for nvram to load\n",
+		tb_to_msecs(mftb() - started));
+
 	return true;
 }
 
-- 
2.9.5



More information about the Skiboot mailing list