From d798c276b4da7559970702c2f31b12549c92741e Mon Sep 17 00:00:00 2001 From: Vasant Hegde Date: Tue, 10 Oct 2017 15:07:48 +0530 Subject: FSP/CONSOLE: Limit number of error logging 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 Signed-off-by: Stewart Smith --- hw/fsp/fsp-console.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'hw/fsp') diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c index 38d4474..a7baf17 100644 --- a/hw/fsp/fsp-console.c +++ b/hw/fsp/fsp-console.c @@ -635,20 +635,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; @@ -688,6 +681,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; } -- cgit v1.1