linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tty: hvc_console: Call hvc_kick in hvc_write unconditionally
@ 2025-08-15 11:33 Fabian Vogt
  2025-08-20  5:21 ` Jiri Slaby
  0 siblings, 1 reply; 2+ messages in thread
From: Fabian Vogt @ 2025-08-15 11:33 UTC (permalink / raw)
  To: Jiri Slaby, Greg Kroah-Hartman, linux-serial, linux-kernel

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.

Cc: stable@vger.kernel.org
Closes: https://bugzilla.opensuse.org/show_bug.cgi?id=1230062
Signed-off-by: Fabian Vogt <fvogt@suse.de>
---
 drivers/tty/hvc/hvc_console.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
index cd1f657f782d..13c663a154c4 100644
--- a/drivers/tty/hvc/hvc_console.c
+++ b/drivers/tty/hvc/hvc_console.c
@@ -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;
 }
-- 
2.50.1







^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] tty: hvc_console: Call hvc_kick in hvc_write unconditionally
  2025-08-15 11:33 [PATCH] tty: hvc_console: Call hvc_kick in hvc_write unconditionally Fabian Vogt
@ 2025-08-20  5:21 ` Jiri Slaby
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Slaby @ 2025-08-20  5:21 UTC (permalink / raw)
  To: Fabian Vogt, Greg Kroah-Hartman, linux-serial, linux-kernel

On 15. 08. 25, 13:33, Fabian Vogt wrote:
> 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.
> 
> Cc: stable@vger.kernel.org
> Closes: https://bugzilla.opensuse.org/show_bug.cgi?id=1230062
> Signed-off-by: Fabian Vogt <fvogt@suse.de>

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.

Reviewed-by: Jiri Slaby <jirislaby@kernel.org>

> ---
>   drivers/tty/hvc/hvc_console.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
> index cd1f657f782d..13c663a154c4 100644
> --- a/drivers/tty/hvc/hvc_console.c
> +++ b/drivers/tty/hvc/hvc_console.c
> @@ -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;
>   }


-- 
js
suse labs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-08-20  5:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-15 11:33 [PATCH] tty: hvc_console: Call hvc_kick in hvc_write unconditionally Fabian Vogt
2025-08-20  5:21 ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).