From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-09-05 12:14:53
Hi Greg,
Here are fixes for a few regressions that came in with my
carelessness with the irq latency work for the hvc subsystem.
These were independently reported in 2 configurations, and I
confirmed with another.
I think those went upstream via Michael's tree, but he's away
at the moment so if you would be able to consider them for
the tty tree that would be appreciated.
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-05 12:14:58
Patch 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.
Fixes: ec97eaad1383 ("tty: hvc: hvc_poll() break hv read loop")
Reported-by: Matteo Croce <redacted>
Reported-by: Jason Gunthorpe <redacted>
Tested-by: Matteo Croce <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-05 12:15:06
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.
Fixes: 550ddadcc758 ("tty: hvc: hvc_write() may sleep")
Tested-by: Matteo Croce <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(-)
From: Jason Gunthorpe <hidden> Date: 2018-09-05 18:51:17
On Wed, Sep 05, 2018 at 10:14:36PM +1000, Nicholas Piggin wrote:
Hi Greg,
Here are fixes for a few regressions that came in with my
carelessness with the irq latency work for the hvc subsystem.
These were independently reported in 2 configurations, and I
confirmed with another.
I think those went upstream via Michael's tree, but he's away
at the moment so if you would be able to consider them for
the tty tree that would be appreciated.
Series works for me too, thanks.
Tested-by: Jason Gunthorpe <redacted>
Jason
From: Nicholas Piggin <npiggin@gmail.com> Date: 2018-09-06 13:11:04
On Wed, 5 Sep 2018 22:14:39 +1000
Nicholas Piggin [off-list ref] wrote:
quoted hunk
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.
Fixes: 550ddadcc758 ("tty: hvc: hvc_write() may sleep")
Tested-by: Matteo Croce <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(-)