diff mbox series

[2/5] serial: expose buf_overrun count through proc interface

Message ID 20180321025241.19785-3-jk@ozlabs.org
State Not Applicable, archived
Headers show
Series serial: implement flow control for ASPEED VUART driver | expand

Commit Message

Jeremy Kerr March 21, 2018, 2:52 a.m. UTC
The buf_overrun count is only every written, and not exposed to
userspace anywhere. This means that dropped characters due to flip
buffer overruns are never visible to userspace.

The /proc/tty/driver/serial file exports a bunch of metrics (including
hardware overruns) already, so add the buf_overrun (as "bo:") to this
file.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
---
 drivers/tty/serial/serial_core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Greg Kroah-Hartman March 23, 2018, 3:29 p.m. UTC | #1
On Wed, Mar 21, 2018 at 10:52:38AM +0800, Jeremy Kerr wrote:
> The buf_overrun count is only every written, and not exposed to
> userspace anywhere. This means that dropped characters due to flip
> buffer overruns are never visible to userspace.
> 
> The /proc/tty/driver/serial file exports a bunch of metrics (including
> hardware overruns) already, so add the buf_overrun (as "bo:") to this
> file.
> 
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> ---
>  drivers/tty/serial/serial_core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 8f3dfc8b5307..fc677534b510 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1780,6 +1780,8 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
>  			seq_printf(m, " brk:%d", uport->icount.brk);
>  		if (uport->icount.overrun)
>  			seq_printf(m, " oe:%d", uport->icount.overrun);
> +		if (uport->icount.buf_overrun)
> +			seq_printf(m, " bo:%d", uport->icount.buf_overrun);

Hopefully this doesn't break any tools that might want to parse this
file :)
Eddie James March 23, 2018, 3:50 p.m. UTC | #2
On 03/20/2018 09:52 PM, Jeremy Kerr wrote:
> The buf_overrun count is only every written, and not exposed to
> userspace anywhere. This means that dropped characters due to flip
> buffer overruns are never visible to userspace.
>
> The /proc/tty/driver/serial file exports a bunch of metrics (including
> hardware overruns) already, so add the buf_overrun (as "bo:") to this
> file.

Tested-by: Eddie James <eajames@linux.vnet.ibm.com>

>
> Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
> ---
>   drivers/tty/serial/serial_core.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> index 8f3dfc8b5307..fc677534b510 100644
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -1780,6 +1780,8 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
>   			seq_printf(m, " brk:%d", uport->icount.brk);
>   		if (uport->icount.overrun)
>   			seq_printf(m, " oe:%d", uport->icount.overrun);
> +		if (uport->icount.buf_overrun)
> +			seq_printf(m, " bo:%d", uport->icount.buf_overrun);
>
>   #define INFOBIT(bit, str) \
>   	if (uport->mctrl & (bit)) \
Jeremy Kerr March 27, 2018, 1:44 a.m. UTC | #3
Hi Greg,

>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
>> index 8f3dfc8b5307..fc677534b510 100644
>> --- a/drivers/tty/serial/serial_core.c
>> +++ b/drivers/tty/serial/serial_core.c
>> @@ -1780,6 +1780,8 @@ static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
>>  			seq_printf(m, " brk:%d", uport->icount.brk);
>>  		if (uport->icount.overrun)
>>  			seq_printf(m, " oe:%d", uport->icount.overrun);
>> +		if (uport->icount.buf_overrun)
>> +			seq_printf(m, " bo:%d", uport->icount.buf_overrun);
> 
> Hopefully this doesn't break any tools that might want to parse this
> file :)

Given that those existing fe/pe/brk/oe fields only appear when they're
non-zero, existing parsing code needs to be tolerant of different sets
of fields being present/absent. Hopefully that means that a new field
shouldn't be too much of a surprise?

Otherwise, I'm happy to report the buf_overrun count elsewhere, if
there's a more suitable place.

Cheers,


Jeremy
diff mbox series

Patch

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 8f3dfc8b5307..fc677534b510 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -1780,6 +1780,8 @@  static void uart_line_info(struct seq_file *m, struct uart_driver *drv, int i)
 			seq_printf(m, " brk:%d", uport->icount.brk);
 		if (uport->icount.overrun)
 			seq_printf(m, " oe:%d", uport->icount.overrun);
+		if (uport->icount.buf_overrun)
+			seq_printf(m, " bo:%d", uport->icount.buf_overrun);
 
 #define INFOBIT(bit, str) \
 	if (uport->mctrl & (bit)) \