[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

SysRq on a serial line (success)


After some poking around I was able to come up with a patch for 2.6, which activates the SysRq key on the serial console (for the sunzilog-based serial ports), without obviously breaking anything. The kernel patch, kernel config and the kernel-image deb (for sparc32) with these changes is available at http://www.wooyd.org/debian/sysrq

When a break is sent, it may trigger both switching to PROM console and
SysRq mode. If switching to PROM console is enabled (by setting the
/proc/sys/kernel/stop-a to 1) then break will cause switching to it. After the execution is resumed (by the PROM's 'go' command), uart_handle_break() is called, setting up->port.sysrq flag for the serial port. If within 5 seconds from that moment a char is received on the serial line, uart_sysrq_handle_char() interprets this char as a SysRq command. If switching to PROM console is turned off, then SysRq mode starts immediately. It appears that in that case the break also puts a NULL character into the input buffer. Patch causes this NULL to be discarded, so that it is not interpreted as a SysRq command.

Example (with /proc/sys/kernel/stop-a set to zero), display running processes:

debian:~# [Send a break, then press 't'] SysRq : Show State

  task             PC      pid father child younger older
init          S F0183290     0     1      0     2               (NOTLB)

ksoftirqd/0   S F0183290     0     2      1             3       (L-TLB)

events/0      S F0183290     0     3      1     4      18     2 (L-TLB)

khelper       S F0183290     0     4      3             5       (L-TLB)

kblockd/0     S F0183290     0     5      3            16     4 (L-TLB)

pdflush       S F0183290     0    16      3            17     5 (L-TLB)

pdflush       S F0183290     0    17      3            19    16 (L-TLB)

aio/0         S F0183290     0    19      3                  17 (L-TLB)

kswapd0       S F0183290     0    18      1           114     3 (L-TLB)

kseriod       S F0183290     0   114      1           124    18 (L-TLB)

scsi_eh_0     S F0183290     0   124      1           174   114 (L-TLB)

kjournald     S F0183290     0   174      1           291   124 (L-TLB)

kjournald     S F0183290     0   291      1           530   174 (L-TLB)

bash          S F0183290     0   530      1                 291 (NOTLB)

Please test this kernel if this seems like a useful feature to you. I guess we could also build the deb for sparc64, if someone is interested.

Best regards,

Jurij Smakov                                        jurij@wooyd.org
Key: http://www.wooyd.org/pgpkey/                   KeyID: C99E03CC

Reply to: