From: Jiri Slaby <jirislaby@kernel.org>
To: li.hao40@zte.com.cn
Cc: gregkh@linuxfoundation.org, linuxppc-dev@lists.ozlabs.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tty: hvc: wakeup hvc console immediately when needed
Date: Fri, 12 Apr 2024 08:51:43 +0200 [thread overview]
Message-ID: <75dff5cd-7b0e-4039-9157-8bf10cf7ba29@kernel.org> (raw)
In-Reply-To: <20240412113848167egmP7kBg1Qm5sxfwGALG-@zte.com.cn>
On 12. 04. 24, 5:38, li.hao40@zte.com.cn wrote:
> From: Li Hao <li.hao40@zte.com.cn>
>
> Cancel the do_wakeup flag in hvc_struct, and change it to immediately
> wake up tty when hp->n_outbuf is 0 in hvc_push().
>
> When we receive a key input character, the interrupt handling function
> hvc_handle_interrupt() will be executed, and the echo thread
> flush_to_ldisc() will be added to the queue.
>
> If the user is currently using tcsetattr(), a hang may occur. tcsetattr()
> enters kernel and waits for hp->n_outbuf to become 0 via
> tty_wait_until_sent(). If the echo thread finishes executing before
> reaching tty_wait_until_sent (for example, put_chars() takes too long),
> it will cause while meeting the wakeup condition (hp->do_wakeup = 1),
> tty_wait_until_sent() cannot be woken up (missed the tty_wakeup() of
> this round's tty_poll). Unless the next key input character comes,
> hvc_poll will be executed, and tty_wakeup() will be performed through
> the do_wakeup flag.
>
> Signed-off-by: Li Hao <li.hao40@zte.com.cn>
> ---
> drivers/tty/hvc/hvc_console.c | 12 +++++-------
> drivers/tty/hvc/hvc_console.h | 1 -
> 2 files changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c
> index cd1f657f7..2fa90d938 100644
> --- a/drivers/tty/hvc/hvc_console.c
> +++ b/drivers/tty/hvc/hvc_console.c
> @@ -476,11 +476,13 @@ static void hvc_hangup(struct tty_struct *tty)
> static int hvc_push(struct hvc_struct *hp)
> {
> int n;
> + struct tty_struct *tty;
>
> n = hp->ops->put_chars(hp->vtermno, hp->outbuf, hp->n_outbuf);
> + tty = tty_port_tty_get(&hp->port);
> if (n <= 0) {
> if (n == 0 || n == -EAGAIN) {
> - hp->do_wakeup = 1;
> + tty_wakeup(tty);
What if tty is NULL? Did you intent to use tty_port_tty_wakeup() instead?
thanks,
--
js
suse labs
next prev parent reply other threads:[~2024-04-12 6:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-12 3:38 [PATCH] tty: hvc: wakeup hvc console immediately when needed li.hao40
2024-04-12 5:10 ` Greg KH
2024-04-12 6:51 ` Jiri Slaby [this message]
2024-04-12 7:48 ` li.hao40
-- strict thread matches above, loose matches on Subject: below --
2024-04-11 13:50 li.hao40
2024-04-11 14:03 ` Greg KH
2024-04-12 3:25 ` li.hao40
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=75dff5cd-7b0e-4039-9157-8bf10cf7ba29@kernel.org \
--to=jirislaby@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=li.hao40@zte.com.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox