[Skiboot] [PATCH 4/4] FSP/CONSOLE: Fix fsp_console_write_buffer_space() call

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

Kernel calls fsp_console_write_buffer_space() to get console buffer
availability. If there is enough buffer space then kernel will call
fsp_console_write() to write actual console data.

In some extreeme corner cases (like one explained in commit c8a7535f)
console becomes full and this function returns 0 to kernel (space available
in console buffer < next incoming write size). Kernel will continue retrying
until it gets enough space. So we will start seeing kernel RCU stalls.

This patch keeps track of previous available space. If previous space is
same as current means, console is full and kernel is retrying. It may be due
to very high console activity and slow response from FSP -OR- we may really
have a issue. Hence lets return max console size so that kernel can make
another try (calling fsp_console_write()) before actually dropping console

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

diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index aa567ab..ba234ff 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -642,6 +642,7 @@ static int64_t fsp_console_write(int64_t term_number, int64_t *length,
 static int64_t fsp_console_write_buffer_space(int64_t term_number,
 					      int64_t *length)
+	static int prev_length = 0;
 	struct fsp_serial *fs;
 	struct fsp_serbuf_hdr *sb;
@@ -660,6 +661,11 @@ static int64_t fsp_console_write_buffer_space(int64_t term_number,
+	if (prev_length == *length)
+		*length = SER_BUF_DATA_SIZE - 1;
+	prev_length = *length;
 	return OPAL_SUCCESS;

More information about the Skiboot mailing list