diff mbox series

powerpc/udbg_hvc: retry putc on -EAGAIN

Message ID 20210514214422.3019105-1-nathanl@linux.ibm.com (mailing list archive)
State Accepted
Headers show
Series powerpc/udbg_hvc: retry putc on -EAGAIN | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch success Successfully applied on branch powerpc/merge (b68d19e1abdbafef9481c7c0b0bcaff34d7af17d)
snowpatch_ozlabs/build-ppc64le success Build succeeded
snowpatch_ozlabs/build-ppc64be success Build succeeded
snowpatch_ozlabs/build-ppc64e success Build succeeded
snowpatch_ozlabs/build-pmac32 success Build succeeded
snowpatch_ozlabs/checkpatch warning total: 1 errors, 0 warnings, 0 checks, 8 lines checked
snowpatch_ozlabs/needsstable success Patch has no Fixes tags

Commit Message

Nathan Lynch May 14, 2021, 9:44 p.m. UTC
hvterm_raw_put_chars() calls hvc_put_chars(), which may return -EAGAIN
when the underlying hcall returns a "busy" status, but udbg_hvc_putc()
doesn't handle this. When using xmon on a PowerVM guest, this can
result in incomplete or garbled output when printing relatively large
amounts of data quickly, such as when dumping the kernel log buffer.

Call again on -EAGAIN.

Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
---
 drivers/tty/hvc/hvc_vio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg Kroah-Hartman May 21, 2021, 12:47 p.m. UTC | #1
On Fri, May 14, 2021 at 04:44:22PM -0500, Nathan Lynch wrote:
> hvterm_raw_put_chars() calls hvc_put_chars(), which may return -EAGAIN
> when the underlying hcall returns a "busy" status, but udbg_hvc_putc()
> doesn't handle this. When using xmon on a PowerVM guest, this can
> result in incomplete or garbled output when printing relatively large
> amounts of data quickly, such as when dumping the kernel log buffer.
> 
> Call again on -EAGAIN.
> 
> Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
> ---
>  drivers/tty/hvc/hvc_vio.c | 2 +-

Subject line does not match up with this file name.

Don't you want "tty" and "hvc" in there somewhere?

thanks,

greg k-h
Michael Ellerman May 23, 2021, 10:51 a.m. UTC | #2
Greg KH <gregkh@linuxfoundation.org> writes:
> On Fri, May 14, 2021 at 04:44:22PM -0500, Nathan Lynch wrote:
>> hvterm_raw_put_chars() calls hvc_put_chars(), which may return -EAGAIN
>> when the underlying hcall returns a "busy" status, but udbg_hvc_putc()
>> doesn't handle this. When using xmon on a PowerVM guest, this can
>> result in incomplete or garbled output when printing relatively large
>> amounts of data quickly, such as when dumping the kernel log buffer.
>> 
>> Call again on -EAGAIN.
>> 
>> Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
>> ---
>>  drivers/tty/hvc/hvc_vio.c | 2 +-
>
> Subject line does not match up with this file name.
>
> Don't you want "tty" and "hvc" in there somewhere?

It's a powerpc only driver, but I guess the subject should still be
"tty: hvc: ..." to match convention.

I was planning to take this via the powerpc tree, but I can drop it if
you'd rather take it.

cheers
Greg Kroah-Hartman May 27, 2021, 11:10 a.m. UTC | #3
On Sun, May 23, 2021 at 08:51:09PM +1000, Michael Ellerman wrote:
> Greg KH <gregkh@linuxfoundation.org> writes:
> > On Fri, May 14, 2021 at 04:44:22PM -0500, Nathan Lynch wrote:
> >> hvterm_raw_put_chars() calls hvc_put_chars(), which may return -EAGAIN
> >> when the underlying hcall returns a "busy" status, but udbg_hvc_putc()
> >> doesn't handle this. When using xmon on a PowerVM guest, this can
> >> result in incomplete or garbled output when printing relatively large
> >> amounts of data quickly, such as when dumping the kernel log buffer.
> >> 
> >> Call again on -EAGAIN.
> >> 
> >> Signed-off-by: Nathan Lynch <nathanl@linux.ibm.com>
> >> ---
> >>  drivers/tty/hvc/hvc_vio.c | 2 +-
> >
> > Subject line does not match up with this file name.
> >
> > Don't you want "tty" and "hvc" in there somewhere?
> 
> It's a powerpc only driver, but I guess the subject should still be
> "tty: hvc: ..." to match convention.
> 
> I was planning to take this via the powerpc tree, but I can drop it if
> you'd rather take it.

No problem, feel free to take it yourself!

greg k-h
Michael Ellerman June 6, 2021, 12:08 p.m. UTC | #4
On Fri, 14 May 2021 16:44:22 -0500, Nathan Lynch wrote:
> hvterm_raw_put_chars() calls hvc_put_chars(), which may return -EAGAIN
> when the underlying hcall returns a "busy" status, but udbg_hvc_putc()
> doesn't handle this. When using xmon on a PowerVM guest, this can
> result in incomplete or garbled output when printing relatively large
> amounts of data quickly, such as when dumping the kernel log buffer.
> 
> Call again on -EAGAIN.

Applied to powerpc/next.

[1/1] powerpc/udbg_hvc: retry putc on -EAGAIN
      https://git.kernel.org/powerpc/c/027f55e87c3094270a3223f7331d033fe15a2b3f

cheers
diff mbox series

Patch

diff --git a/drivers/tty/hvc/hvc_vio.c b/drivers/tty/hvc/hvc_vio.c
index 798f27f40cc2..76d2a7038095 100644
--- a/drivers/tty/hvc/hvc_vio.c
+++ b/drivers/tty/hvc/hvc_vio.c
@@ -249,7 +249,7 @@  static void udbg_hvc_putc(char c)
 			count = hvterm_hvsi_put_chars(0, &c, 1);
 			break;
 		}
-	} while(count == 0);
+	} while(count == 0 || count == -EAGAIN);
 }
 
 static int udbg_hvc_getc_poll(void)