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

Vasant Hegde hegdevasant at linux.vnet.ibm.com
Tue Oct 10 20:37:48 AEDT 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.

Also with previous patch, once console buffer is full, OPAL is returning error
to payload from fsp_console_write_buffer_space(). So payload will never call
fsp_console_write(). Hence move error logging logic to right place.

Signed-off-by: Vasant Hegde <hegdevasant at linux.vnet.ibm.com>
---
Changes in v2:
  - Moved code from fsp_console_write() to fsp_console_write_buffer_space()

-Vasant

 hw/fsp/fsp-console.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index 77eb69f..1646f13 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -629,20 +629,13 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length,
 	if (written)
 		return OPAL_SUCCESS;
 
-	/*
-	 * FSP is still active but not reading console data. Hence
-	 * our console buffer became full. Most likely IPMI daemon
-	 * 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");
 	return OPAL_HARDWARE;
 }
 
 static int64_t fsp_console_write_buffer_space(int64_t term_number,
 					      int64_t *length)
 {
+	static bool elog_generated = false;
 	struct fsp_serial *fs;
 	struct fsp_serbuf_hdr *sb;
 
@@ -682,6 +675,18 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number,
 	if (tb_compare(mftb(), fs->out_buf_timeout) != TB_AAFTERB)
 		return OPAL_SUCCESS;
 
+	/*
+	 * FSP is still active but not reading console data. Hence
+	 * our console buffer became full. Most likely IPMI daemon
+	 * on FSP is buggy. Lets log error and return OPAL_RESOURCE
+	 * to payload (Linux).
+	 */
+	if (!elog_generated) {
+		elog_generated = true;
+		log_simple_error(&e_info(OPAL_RC_CONSOLE_HANG), "FSPCON: Console "
+				 "buffer is full, dropping console data\n");
+	}
+
 	/* Timeout happened. Lets drop incoming data */
 	return OPAL_RESOURCE;
 }
-- 
2.9.3



More information about the Skiboot mailing list