diff mbox series

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

Message ID 20170924174537.26518-3-hegdevasant@linux.vnet.ibm.com
State Superseded
Headers show
Series [1/4] FSP/CONSOLE: Do not associate unavailable console | expand

Commit Message

Vasant Hegde Sept. 24, 2017, 5:45 p.m. UTC
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@linux.vnet.ibm.com>
---
 hw/fsp/fsp-console.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Ananth N Mavinakayanahalli Sept. 25, 2017, 3:10 p.m. UTC | #1
On Sun, Sep 24, 2017 at 05:45:36PM +0000, Vasant Hegde wrote:
> 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@linux.vnet.ibm.com>

Acked-by: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
diff mbox series

Patch

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;
 }