linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dmitry Safonov <dima@arista.com>
To: Joe Perches <joe@perches.com>, linux-kernel@vger.kernel.org
Cc: Dmitry Safonov <0x7f454c46@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Jiri Slaby <jslaby@suse.com>,
	Vasiliy Khoruzhick <vasilykh@arista.com>,
	linux-serial@vger.kernel.org
Subject: Re: [PATCH-next 3/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE
Date: Fri, 10 Jan 2020 22:10:15 +0000	[thread overview]
Message-ID: <056bff50-f67e-f00f-c98f-ccb427344691@arista.com> (raw)
In-Reply-To: <5293a7cb1ccb16275ddb36c7f26fb9e83f4fac9b.camel@perches.com>

Hi Joe,

On 1/10/20 4:50 PM, Joe Perches wrote:
> On Thu, 2020-01-09 at 21:54 +0000, Dmitry Safonov wrote:
>> Many embedded boards have a disconnected TTL level serial which can
>> generate some garbage that can lead to spurious false sysrq detects.
> 
> trivia:
> 
>> diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
> []
>> @@ -3081,6 +3081,38 @@ void uart_insert_char(struct uart_port *port, unsigned int status,
> []
>> +const char sysrq_toggle_seq[] = CONFIG_MAGIC_SYSRQ_SERIAL_SEQUENCE;
> 
> static const?

Will do, thanks!

> 
>> +static int uart_try_toggle_sysrq(struct uart_port *port, unsigned int ch)
> 
> This function return might read better as bool not int

Yeah, no hard feelings, will convert.

[..]
>> @@ -243,10 +243,10 @@ struct uart_port {
>>  	unsigned long		sysrq;			/* sysrq timeout */
>>  	unsigned int		sysrq_ch;		/* char for sysrq */
>>  	unsigned char		has_sysrq;
>> +	unsigned char		sysrq_seq;		/* index in sysrq_toggle_seq */
> 
> unsigned int?
> 
> Or maybe set a maximum length of MAGIC_SYSRQ_SERIAL_SEQUENCE.

I think, 256 chars should be enough to send on serial (c)

I'm not aware of a way to put the max string length in Kconfig, so I did
in the patch:
BUILD_BUG_ON(ARRAY_SIZE(sysrq_toggle_seq) >=
sizeof(port->sysrq_seq)*U8_MAX);

Do you have something more elegant in your mind?

Thanks,
          Dmitry

  reply	other threads:[~2020-01-10 22:10 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-09 21:54 [PATCH-next 0/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE Dmitry Safonov
2020-01-09 21:54 ` [PATCH-next 1/3] serial_core: Move sysrq functions from header file Dmitry Safonov
2020-01-10 16:50   ` Greg Kroah-Hartman
2020-01-09 21:54 ` [PATCH-next 2/3] sysctl/sysrq: Remove __sysrq_enabled copy Dmitry Safonov
2020-01-10  3:19   ` Iurii Zaikin
2020-01-10 21:48     ` Dmitry Safonov
2020-01-10 16:40   ` Greg Kroah-Hartman
2020-01-10 21:45     ` Dmitry Safonov
2020-01-10 22:01       ` Greg Kroah-Hartman
2020-01-09 21:54 ` [PATCH-next 3/3] serial/sysrq: Add MAGIC_SYSRQ_SERIAL_SEQUENCE Dmitry Safonov
2020-01-09 23:53   ` Randy Dunlap
2020-01-10 22:02     ` Dmitry Safonov
2020-01-10 16:46   ` Greg Kroah-Hartman
2020-01-10 22:32     ` Dmitry Safonov
2020-01-14 19:10       ` Dmitry Safonov
2020-01-15 12:42         ` Greg Kroah-Hartman
2020-01-10 16:50   ` Joe Perches
2020-01-10 22:10     ` Dmitry Safonov [this message]
2020-01-11 14:08       ` Joe Perches
2020-01-10 19:01   ` kbuild test robot
2020-01-10 19:20   ` kbuild test robot
2020-01-11 10:52   ` kbuild test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=056bff50-f67e-f00f-c98f-ccb427344691@arista.com \
    --to=dima@arista.com \
    --cc=0x7f454c46@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=jslaby@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=vasilykh@arista.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).