diff options
author | Nicholas Piggin <npiggin@gmail.com> | 2018-09-09 01:39:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-09-10 12:04:31 -0400 |
commit | 6e7f6b82c60afb46ff71c2127421c66207966d6d (patch) | |
tree | 379d99391da9a5e9404964b4cf5cd28ec49889dd | |
parent | 11da3a7f84f19c26da6f86af878298694ede0804 (diff) |
tty: hvc: hvc_poll() fix read loop hang
Commit ec97eaad1383 ("tty: hvc: hvc_poll() break hv read loop") causes
the virtio console to hang at times (e.g., if you paste a bunch of
characters to it.
The reason is that get_chars must return 0 before we can be sure the
driver will kick or poll input again, but this change only scheduled a
poll if get_chars had returned a full count. Change this to poll on
any > 0 count.
Reported-by: Matteo Croce <mcroce@redhat.com>
Reported-by: Jason Gunthorpe <jgg@mellanox.com>
Tested-by: Matteo Croce <mcroce@redhat.com>
Tested-by: Jason Gunthorpe <jgg@mellanox.com>
Tested-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/hvc/hvc_console.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/tty/hvc/hvc_console.c b/drivers/tty/hvc/hvc_console.c index 5414c4a87bea..c917749708d2 100644 --- a/drivers/tty/hvc/hvc_console.c +++ b/drivers/tty/hvc/hvc_console.c | |||
@@ -717,10 +717,13 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep) | |||
717 | #endif /* CONFIG_MAGIC_SYSRQ */ | 717 | #endif /* CONFIG_MAGIC_SYSRQ */ |
718 | tty_insert_flip_char(&hp->port, buf[i], 0); | 718 | tty_insert_flip_char(&hp->port, buf[i], 0); |
719 | } | 719 | } |
720 | if (n == count) | ||
721 | poll_mask |= HVC_POLL_READ; | ||
722 | read_total = n; | 720 | read_total = n; |
723 | 721 | ||
722 | /* | ||
723 | * Latency break, schedule another poll immediately. | ||
724 | */ | ||
725 | poll_mask |= HVC_POLL_READ; | ||
726 | |||
724 | out: | 727 | out: |
725 | /* Wakeup write queue if necessary */ | 728 | /* Wakeup write queue if necessary */ |
726 | if (hp->do_wakeup) { | 729 | if (hp->do_wakeup) { |