Skip to contentSkip to conversation

2.4.3 and SysRq over serial console

PATCH In review Tom Rini 2 participants 4 messages Mar 31, 2001 – Apr 3, 2001

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 2.4.3 and SysRq over serial console

Hello all. Without the attached patch, SysRq doesn't work over a serial console here. Has anyone else seen this problem?

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
linux/drivers/char/n_tty.c +16 -0
diff -Nru a/linux/drivers/char/n_tty.c b/linux/drivers/char/n_tty.c
@@ -40,6 +40,10 @@
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/poll.h>
+#ifdef CONFIG_MAGIC_SYSRQ	/* Handle the SysRq Hack */
+#include <linux/sysrq.h>
+#include <linux/console.h>
+#endif
 
 #include <asm/uaccess.h>
 #include <asm/system.h>
@@ -458,6 +462,12 @@
 
 static inline void n_tty_receive_break(struct tty_struct *tty)
 {
+#ifdef CONFIG_MAGIC_SYSRQ	/* Handle the SysRq Hack */
+	struct console *c = console_drivers;
+	if (c && c->device && (c->device(c) == tty->device)
+	    && !test_and_change_bit(TTY_DOING_SYSRQ, &tty->flags))
+		return;
+#endif
 	if (I_IGNBRK(tty))
 		return;
 	if (I_BRKINT(tty)) {
@@ -506,6 +516,12 @@
 {
 	unsigned long flags;
 
+#ifdef CONFIG_MAGIC_SYSRQ	/* Handle the SysRq Hack */
+	if (test_and_clear_bit(TTY_DOING_SYSRQ, &tty->flags)) {
+		handle_sysrq(c, NULL, NULL, tty);
+		return;
+	}
+#endif
 	if (tty->raw) {
 		put_tty_queue(c, tty);
 		return;
linux/include/linux/tty.h +3 -0
diff -Nru a/linux/include/linux/tty.h b/linux/include/linux/tty.h
@@ -329,6 +329,9 @@
 #define TTY_PUSH 6
 #define TTY_CLOSING 7
 #define TTY_DONT_FLIP 8
+#ifdef CONFIG_MAGIC_SYSRQ	/* Handle the SysRq Hack */
+#define TTY_DOING_SYSRQ 9
+#endif
 #define TTY_HW_COOK_OUT 14
 #define TTY_HW_COOK_IN 15
 #define TTY_PTY_LOCK 16
#1 lore raw
Quoted 2 lines · Tom Rini

Hello all. Without the attached patch, SysRq doesn't work over a serial console here. Has anyone else seen this problem?

It is handled at the serial port driver level, not the tty level. You need to turn on CONFIG_SERIAL_CONSOLE and CONFIG_MAGIC_SYSRQ, and issue a break followed by the relevent character within 5 seconds on the serial TTY being used as the kernel console.

--
Russell King ([email protected]) The developer of ARM Linux
http://www.arm.linux.org.uk/personal/aboutme.html

author
#2 lore raw
In reply to Tom Rini
Quoted 8 lines · Russell King
Quoted 2 lines · Tom Rini

Hello all. Without the attached patch, SysRq doesn't work over a serial console here. Has anyone else seen this problem?

It is handled at the serial port driver level, not the tty level. You need to turn on CONFIG_SERIAL_CONSOLE and CONFIG_MAGIC_SYSRQ, and issue a break followed by the relevent character within 5 seconds on the serial TTY being used as the kernel console.

That wasn't working here however. Unless minicom isn't sending the proper break. Doing the keycombo which slips my mind to send a break, followed by 'h' in minicom does nothing.

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/
author
#3 lore raw
In reply to Tom Rini
Quoted 8 lines · Russell King
Quoted 2 lines · Tom Rini

Hello all. Without the attached patch, SysRq doesn't work over a serial console here. Has anyone else seen this problem?

It is handled at the serial port driver level, not the tty level. You need to turn on CONFIG_SERIAL_CONSOLE and CONFIG_MAGIC_SYSRQ, and issue a break followed by the relevent character within 5 seconds on the serial TTY being used as the kernel console.

After talking with the person who originally did the patch, yeah, that does make sense (and the serial driver we're using needs to be fixed). Thanks.

Signature · 2 lines
Tom Rini (TR1265)
http://gate.crashing.org/~trini/