Skip to contentSkip to conversation

A question about break and sysrq on a serial console (2.6.19.1)

DISCUSSION Brian Beattie 2 participants 4 messages Jan 17, 2007 – Jan 18, 2007 2 messages not in the archive

lore
Share & tools
lore
#0 lore raw

I'm trying to do a SYSRQ over a serial console. As I understand it a break will do that, but I'm not seeing the SYSRQ. In looking at uart_handle_break() in drivers/serial/8250.c it looks like the code will toggle port->sysrq, rather than just setting it when the port is a console. I think the correct code would be to move the "port->sysrq = 0;" to follow the closing brace on the next line, or am I missing something.

--------------
/*
* We do the SysRQ and SAK checking like this... */
static inline int uart_handle_break(struct uart_port *port)

{
    struct uart_info *info = port->info;
#ifdef SUPPORT_SYSRQ
    if (port->cons && port->cons->index == port->line) {
        if (!port->sysrq) {
            port->sysrq = jiffies + HZ*5;
            return 1;
        }
        port->sysrq = 0;
    }
#endif
    if (port->flags & UPF_SAK)
        do_SAK(info->tty);
    return 0;
}

-------------

It seem to me that this code will toggle port->sysrq.

Signature · 4 lines
Brian Beattie
Firmware Engineer
APCON, Inc.
[email protected]
#1 lore raw
Quoted 7 lines · Brian Beattie

I'm trying to do a SYSRQ over a serial console. As I understand it a break will do that, but I'm not seeing the SYSRQ. In looking at uart_handle_break() in drivers/serial/8250.c it looks like the code will toggle port->sysrq, rather than just setting it when the port is a console. I think the correct code would be to move the "port->sysrq = 0;" to follow the closing brace on the next line, or am I missing something.

Thereby preventing the action of <break> (which may be to cause a SAK event, which would be rather important on a console to ensure that you're really logging in rather than typing your password into another users program which just looks like a login program.)

Note that the sequence for sysrq is:

(non-break characters or nothing) <break> <sysrq-char>

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:

A message that is not in the archive (sent off-list or not yet received): 1169137187.16802.26.camel@brianb

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 28 lines · Russell King
Quoted 19 lines · Brian Beattie
Quoted 9 lines · Russell King
Quoted 7 lines · Brian Beattie

I'm trying to do a SYSRQ over a serial console. As I understand it a break will do that, but I'm not seeing the SYSRQ. In looking at uart_handle_break() in drivers/serial/8250.c it looks like the code will toggle port->sysrq, rather than just setting it when the port is a console. I think the correct code would be to move the "port->sysrq = 0;" to follow the closing brace on the next line, or am I missing something.

Quoted 9 lines

Thereby preventing the action of <break> (which may be to cause a SAK event, which would be rather important on a console to ensure that you're really logging in rather than typing your password into another users program which just looks like a login program.)

Note that the sequence for sysrq is:

(non-break characters or nothing) <break> <sysrq-char>

Quoted 7 lines

well the code as is, is not working. Printk's tell me that uart_handle_break() is called repeatedly while the break condition is active, toggling port->sysrq so that it's a 50/50 chance on whether port->sysrq will be set or cleared when the break condition ends. On the other hand the 8250 break condition handling code is not working anyway, so the problem may be that the 8250 code is not calling uart_handle_break() correctly.

Quoted 1 line

Please learn to use the "reply to all" button when using mailing lists.

I don't post much to LKML, I realized after I hit send I needed to reply all.

Quoted 3 lines

Works fine here. Which UART are you actually using? At a guess, it's probably a bad clone which does not have a correct break implementation.

it's the built-in mpc8349 powerpc uart.

Quoted 1 line
Signature · 4 lines
Brian Beattie
Firmware Engineer
APCON, Inc.
[email protected]
#5 lore raw
Quoted 29 lines · Brian Beattie
Quoted 28 lines · Russell King
Quoted 26 lines · Brian Beattie
Quoted 9 lines · Russell King
Quoted 7 lines · Brian Beattie

I'm trying to do a SYSRQ over a serial console. As I understand it a break will do that, but I'm not seeing the SYSRQ. In looking at uart_handle_break() in drivers/serial/8250.c it looks like the code will toggle port->sysrq, rather than just setting it when the port is a console. I think the correct code would be to move the "port->sysrq = 0;" to follow the closing brace on the next line, or am I missing something.

Quoted 9 lines

Thereby preventing the action of <break> (which may be to cause a SAK event, which would be rather important on a console to ensure that you're really logging in rather than typing your password into another users program which just looks like a login program.)

Note that the sequence for sysrq is:

(non-break characters or nothing) <break> <sysrq-char>

well the code as is, is not working. Printk's tell me that uart_handle_break() is called repeatedly while the break condition is active, toggling port->sysrq so that it's a 50/50 chance on whether port->sysrq will be set or cleared when the break condition ends. On the other hand the 8250 break condition handling code is not working anyway, so the problem may be that the 8250 code is not calling uart_handle_break() correctly.

Quoted 8 lines
Quoted 1 line

Please learn to use the "reply to all" button when using mailing lists.

I don't post much to LKML, I realized after I hit send I needed to reply all.

Quoted 3 lines

Works fine here. Which UART are you actually using? At a guess, it's probably a bad clone which does not have a correct break implementation.

it's the built-in mpc8349 powerpc uart.

Well, it looks like this UART has a differing behaviour to proper 16xxx UARTs - it says that the BI will be cleared when a stop bit is received in addition to when the LSR is read. That means that unless you check the LSR while the break condition is present, you may never know one existed.

Standard 8250-compatible UARTs only clear the BI when the LSR is read.

As for the rest of the description, it's quite loose. It doesn't really say under what conditions the BI bit is set, but I suggest that your UART repeatedly (and incorrectly) sets the BI bit when no *new* break condition exists. That would certainly explain your behaviour.

Again, standard 8250-compatible UARTs don't do this.

Not sure how to fix this without other people seeing a behavioural change.

Signature · 3 lines
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of: