diff mbox

tty: kgdb_nmi: Convert kgdb_nmi_tty_enabled into a module parameter

Message ID 1405081811-15254-1-git-send-email-daniel.thompson@linaro.org
State New
Headers show

Commit Message

Daniel Thompson July 11, 2014, 12:30 p.m. UTC
At present it is not possible to boot with the ttyNMI0 console treating
character input normally. To use the console requires that kdb be
entered and the nmi_console command be used to enable the console (or if
only kgdb is present then gdb must directly manipulate the value of
kgdb_nmi_tty_enabled).

Introducing a module parameter makes the console much more usable.

Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>
Cc: linux-serial@vger.kernel.org
---
 drivers/tty/serial/kgdb_nmi.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Greg KH July 12, 2014, 12:47 a.m. UTC | #1
On Fri, Jul 11, 2014 at 01:30:11PM +0100, Daniel Thompson wrote:
> At present it is not possible to boot with the ttyNMI0 console treating
> character input normally. To use the console requires that kdb be
> entered and the nmi_console command be used to enable the console (or if
> only kgdb is present then gdb must directly manipulate the value of
> kgdb_nmi_tty_enabled).
> 
> Introducing a module parameter makes the console much more usable.
> 
> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Jiri Slaby <jslaby@suse.cz>
> Cc: linux-serial@vger.kernel.org
> ---
>  drivers/tty/serial/kgdb_nmi.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
> index cfadf29..9361d69 100644
> --- a/drivers/tty/serial/kgdb_nmi.c
> +++ b/drivers/tty/serial/kgdb_nmi.c
> @@ -43,6 +43,11 @@ module_param_named(magic, kgdb_nmi_magic, charp, 0600);
>  MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)");
>  
>  static bool kgdb_nmi_tty_enabled;
> +module_param_named(tty, kgdb_nmi_tty_enabled, bool, 0600);
> +MODULE_PARM_DESC(tty, "if set to false (default), characters received from "
> +		      "the UART will be passed exclusively to the knock "
> +		      "detector; when set to true characters will be passed "
> +		      "both to the knock detector and to the TTY layer");

Module options suck rocks through straws.

Isn't there _any_ other way to determine this "dynamically"?  How will
someone know to set this option?

Yeah, there are other options in this module, but please, why add more?

greg k-h
Daniel Thompson July 14, 2014, 9:24 a.m. UTC | #2
On 12/07/14 01:47, Greg Kroah-Hartman wrote:
> On Fri, Jul 11, 2014 at 01:30:11PM +0100, Daniel Thompson wrote:
>> At present it is not possible to boot with the ttyNMI0 console treating
>> character input normally. To use the console requires that kdb be
>> entered and the nmi_console command be used to enable the console (or if
>> only kgdb is present then gdb must directly manipulate the value of
>> kgdb_nmi_tty_enabled).
>>
>> Introducing a module parameter makes the console much more usable.
>>
>> Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Cc: Jiri Slaby <jslaby@suse.cz>
>> Cc: linux-serial@vger.kernel.org
>> ---
>>  drivers/tty/serial/kgdb_nmi.c | 5 +++++
>>  1 file changed, 5 insertions(+)
>>
>> diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
>> index cfadf29..9361d69 100644
>> --- a/drivers/tty/serial/kgdb_nmi.c
>> +++ b/drivers/tty/serial/kgdb_nmi.c
>> @@ -43,6 +43,11 @@ module_param_named(magic, kgdb_nmi_magic, charp, 0600);
>>  MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)");
>>  
>>  static bool kgdb_nmi_tty_enabled;
>> +module_param_named(tty, kgdb_nmi_tty_enabled, bool, 0600);
>> +MODULE_PARM_DESC(tty, "if set to false (default), characters received from "
>> +		      "the UART will be passed exclusively to the knock "
>> +		      "detector; when set to true characters will be passed "
>> +		      "both to the knock detector and to the TTY layer");
> 
> Module options suck rocks through straws.
> 
> Isn't there _any_ other way to determine this "dynamically"?  How will
> someone know to set this option?
> 
> Yeah, there are other options in this module, but please, why add more?

Thanks for the comment.

Yes. I think we can do this dynamically.

The two modes currently offered are:

1. characters bypass TTY layer and knock detector interactively prompts
   for the knock ('Press $3#33 to enter debugger>')

2. characters are routed to TTY layer and to a (silenced) knock
   detector

I think we might be able to select modes based on whether there is a
userspace process reading from the tty (i.e. if there is a getty then
act like a proper tty, if there is no getty allow prompting).
diff mbox

Patch

diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index cfadf29..9361d69 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -43,6 +43,11 @@  module_param_named(magic, kgdb_nmi_magic, charp, 0600);
 MODULE_PARM_DESC(magic, "magic sequence to enter NMI debugger (default $3#33)");
 
 static bool kgdb_nmi_tty_enabled;
+module_param_named(tty, kgdb_nmi_tty_enabled, bool, 0600);
+MODULE_PARM_DESC(tty, "if set to false (default), characters received from "
+		      "the UART will be passed exclusively to the knock "
+		      "detector; when set to true characters will be passed "
+		      "both to the knock detector and to the TTY layer");
 
 static int kgdb_nmi_console_setup(struct console *co, char *options)
 {