Skip to contentSkip to conversation

tty: hvc_console: Call hvc_kick in hvc_write unconditionally

PATCH In review Fabian Vogt 2 participants 2 messages Aug 15, 2025 – Aug 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tty: hvc_console: Call hvc_kick in hvc_write unconditionally

After hvc_write completes, call hvc_kick also in the case the output buffer has been drained, to ensure tty_wakeup gets called.

This fixes that functions which wait for a drained buffer got stuck occasionally.

---
 drivers/tty/hvc/hvc_console.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/hvc/hvc_console.c +3 -3
index cd1f657f782d..13c663a154c4 100644
@@ -543,10 +543,10 @@ static ssize_t hvc_write(struct tty_struct *tty, const u8 *buf, size_t count)
 	}
 
 	/*
-	 * Racy, but harmless, kick thread if there is still pending data.
+	 * Kick thread to flush if there's still pending data
+	 * or to wakeup the write queue.
 	 */
-	if (hp->n_outbuf)
-		hvc_kick();
+	hvc_kick();
 
 	return written;
 }
Signature · 1 line
2.50.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Fabian Vogt

After hvc_write completes, call hvc_kick also in the case the output buffer has been drained, to ensure tty_wakeup gets called.

This fixes that functions which wait for a drained buffer got stuck occasionally.

It's hard to tell if it the right thing™ as HVC is a mess. But on the basic code level, LGTM. Let's see if something pops up.

Quoted 22 lines
---
  drivers/tty/hvc/hvc_console.c | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)
drivers/tty/hvc/hvc_console.c +3 -3
index cd1f657f782d..13c663a154c4 100644
@@ -543,10 +543,10 @@ static ssize_t hvc_write(struct tty_struct *tty, const u8 *buf, size_t count)
  	}
 
  	/*
-	 * Racy, but harmless, kick thread if there is still pending data.
+	 * Kick thread to flush if there's still pending data
+	 * or to wakeup the write queue.
  	 */
-	if (hp->n_outbuf)
-		hvc_kick();
+	hvc_kick();
 
  	return written;
  }
Signature · 2 lines
js
suse labs