# \[PATCH\] powerpc/udbg\_hvc: retry putc on -EAGAIN

- Subsystems: HYPERVISOR VIRTUAL CONSOLE DRIVER, THE REST, TTY LAYER AND SERIAL DRIVERS
- Maintainers: Linus Torvalds, Greg Kroah-Hartman, Jiri Slaby
- Status: LANDED (027f55e87c30 · 2021-05-23 10:51)
- Landed in mainline as 027f55e87c30 on 2021-05-23.
- List: linuxppc-dev
- 5 messages, 4 authors
- Page: https://ratatoskr.run/linuxppc-dev/2021/05/1378232/t

## \[PATCH\] powerpc/udbg\_hvc: retry putc on -EAGAIN

- From: Nathan Lynch \<hidden\>
- Date: 2021-05-14 21:44:37 
- Message: https://ratatoskr.run/linuxppc-dev/2021/05/1378232.md

```text
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 <redacted>
---
 drivers/tty/hvc/hvc_vio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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)
-- 
2.30.2

```

## Re: \[PATCH\] powerpc/udbg\_hvc: retry putc on -EAGAIN

- From: Greg KH \<gregkh@linuxfoundation.org\>
- Date: 2021-05-21 12:47:45 
- Message: https://ratatoskr.run/linuxppc-dev/2021/05/1387462.md

```text
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 <redacted>
> ---
>  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
```

## Re: \[PATCH\] powerpc/udbg\_hvc: retry putc on -EAGAIN

- From: Michael Ellerman \<mpe@ellerman.id.au\>
- Date: 2021-05-23 10:51:19 
- Message: https://ratatoskr.run/linuxppc-dev/2021/05/1388648.md

```text
Greg KH [ref] 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 <redacted>
>> ---
>>  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
```

## Re: \[PATCH\] powerpc/udbg\_hvc: retry putc on -EAGAIN

- From: Greg KH \<gregkh@linuxfoundation.org\>
- Date: 2021-05-27 11:10:31 
- Message: https://ratatoskr.run/linuxppc-dev/2021/05/1393857.md

```text
On Sun, May 23, 2021 at 08:51:09PM +1000, Michael Ellerman wrote:
> Greg KH [ref] 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 <redacted>
> >> ---
> >>  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
```

## Re: \[PATCH\] powerpc/udbg\_hvc: retry putc on -EAGAIN

- From: Michael Ellerman \<hidden\>
- Date: 2021-06-06 12:13:05 
- Message: https://ratatoskr.run/linuxppc-dev/2021/06/1403910.md

```text
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
```
