From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-09-09 05:39:29
Re-sending this one with the used-uinitialized warning in patch
3 fixed.
Greg these patches are needed to fix regressions in this merge
window, please consider them for your tty tree.
Thanks,
Nick
Nicholas Piggin (3):
tty: hvc: hvc_poll() fix read loop hang
tty: hvc: hvc_poll() fix read loop batching
tty: hvc: hvc_write() fix break condition
drivers/tty/hvc/hvc_console.c | 38 ++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
--
2.18.0
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-09-09 05:39:34
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 <redacted>
Reported-by: Jason Gunthorpe <redacted>
Tested-by: Matteo Croce <redacted>
Tested-by: Jason Gunthorpe <redacted>
Tested-by: Leon Romanovsky <redacted>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
drivers/tty/hvc/hvc_console.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
@@ -669,8 +678,8 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)if(!hp->irq_requested)poll_mask|=HVC_POLL_READ;+read_again:/* Read data if any */-count=tty_buffer_request_room(&hp->port,N_INBUF);/* If flip is full, just reschedule a later read */
@@ -717,7 +726,18 @@ static int __hvc_poll(struct hvc_struct *hp, bool may_sleep)#endif /* CONFIG_MAGIC_SYSRQ */tty_insert_flip_char(&hp->port,buf[i],0);}-read_total=n;+read_total+=n;++if(may_sleep){+/* Keep going until the flip is full */+spin_unlock_irqrestore(&hp->lock,flags);+cond_resched();+spin_lock_irqsave(&hp->lock,flags);+gotoread_again;+}elseif(read_total<HVC_ATOMIC_READ_MAX){+/* Break and defer if it's a large read in atomic */+gotoread_again;+}/**Latencybreak,scheduleanotherpollimmediately.
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-09-09 05:39:43
Commit 550ddadcc758 ("tty: hvc: hvc_write() may sleep") broke the
termination condition in case the driver stops accepting characters.
This can result in unnecessary polling of the busy driver.
Restore it by testing the hvc_push return code.
Tested-by: Matteo Croce <redacted>
Tested-by: Jason Gunthorpe <redacted>
Tested-by: Leon Romanovsky <redacted>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
drivers/tty/hvc/hvc_console.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
On Sun, Sep 09, 2018 at 03:39:13PM +1000, Nicholas Piggin wrote:
Re-sending this one with the used-uinitialized warning in patch
3 fixed.
Greg these patches are needed to fix regressions in this merge
window, please consider them for your tty tree.