[Skiboot] [PATCH 3/4] FSP/CONSOLE: Limit number of error logging

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Mon Sep 25 03:45:36 AEST 2017


Commit c8a7535f (FSP/CONSOLE: Workaround for unresponsive ipmi daemon) added
error logging when buffer is full. In some corner cases kernel may call this
function multiple time and we may endup logging error again and again.

This patch fixes it by generating error log only once. I think this is enough
to indicate something went wrong.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
 hw/fsp/fsp-console.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index be11d9b..aa567ab 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -587,6 +587,7 @@ void fsp_console_preinit(void)
 static int64_t fsp_console_write(int64_t term_number, int64_t *length,
 				 const uint8_t *buffer)
 {
+	static bool elog_generated = false;
 	struct fsp_serial *fs;
 	size_t written, requested;
 
@@ -629,8 +630,12 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length,
 	 * on FSP is buggy. Lets log error and return OPAL_HARDWARE
 	 * to payload (Linux).
 	 */
-	log_simple_error(&e_info(OPAL_RC_CONSOLE_HANG), "FSPCON: Console "
-			 "buffer is full, dropping console data\n");
+	if (!elog_generated) {
+		elog_generated = true;
+		log_simple_error(&e_info(OPAL_RC_CONSOLE_HANG), "FSPCON: Console "
+				 "buffer is full, dropping console data\n");
+	}
+
 	return OPAL_HARDWARE;
 }
 
-- 
2.9.3



More information about the Skiboot mailing list