mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Russell King <rmk+lkml@arm.linux.org.uk>
To: Sachin Sant <sachinp@in.ibm.com>
Cc: lkml <linux-kernel@vger.kernel.org>, ssant@in.ibm.com
Subject: Re: [RFC] [PATCH] Adding ctrl-o sysrq hack support to 8250 driver
Date: Wed, 30 Nov 2005 13:04:29 +0000	[thread overview]
Message-ID: <20051130130429.GB25032@flint.arm.linux.org.uk> (raw)
In-Reply-To: <438D8A3A.9030400@in.ibm.com>

On Wed, Nov 30, 2005 at 04:47:14PM +0530, Sachin Sant wrote:
> The following patch will allow a user to use sysrq keys over a serial 
> console using the ctrl-o key sequence. This is similar to functionality 
> provided by the hvc console drivers on PPC boxes.

Several problems:
1. ^O is normally the "flush" control code, for discarding unsent output.
2. ^O might be inadvertantly received due to a connected PC trying to
   auto-detect connected devices.
3. see review below.

> diff -Naurp linux-2.6.14.3/drivers/serial/8250.c linux-2.6.14.3-new/drivers/serial/8250.c
> --- linux-2.6.14.3/drivers/serial/8250.c	2005-11-11 11:03:12.000000000 +0530
> +++ linux-2.6.14.3-new/drivers/serial/8250.c	2005-11-17 15:12:42.000000000 +0530
> @@ -1084,6 +1084,23 @@ receive_chars(struct uart_8250_port *up,
>  			 */
>  		}
>  		ch = serial_inp(up, UART_RX);
> +
> +#if defined(CONFIG_MAGIC_SYSRQ) && defined(CONFIG_SERIAL_CORE_CONSOLE)
> +		/* Handle the SysRq ^O Hack */
> +		if (ch == '\x0f') {
> +			up->port.sysrq = jiffies + HZ*5;

Why are you doing this and not using uart_handle_break()?

Do you realise that this enables sysrq support for _any_ 8250 serial
port, be it console or not?

> +			goto ignore_char; 
> +		}
> +		if (up->port.sysrq) {
> +			int swallow;
> +			spin_unlock(&up->port.lock);
> +			swallow = uart_handle_sysrq_char(&up->port, ch, regs);
> +			spin_lock(&up->port.lock);

We don't drop the lock when calling uart_handle_sysrq_char() further
down in this function.  Why is this needed?  Also, why is this needed
to be duplicated?

> +			if (swallow)
> +				goto ignore_char;
> +		}
> +#endif /* CONFIG_MAGIC_SYSRQ && CONFIG_SERIAL_CORE_CONSOLE */
> +
>  		flag = TTY_NORMAL;
>  		up->port.icount.rx++;
>  

Sorry, NACK.

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core

  parent reply	other threads:[~2005-11-30 13:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-30 11:17 Sachin Sant
2005-11-30 12:12 ` Arjan van de Ven
2005-11-30 13:04 ` Russell King [this message]
2005-12-06  6:48   ` Sachin Sant
2005-12-06 17:16     ` Russell King
2005-12-07  6:31       ` Sachin Sant
2005-12-07 22:22       ` Olaf Hering
2005-12-07 23:39         ` Russell King
2005-12-08 14:58           ` Olaf Hering
2005-12-08  1:38 Milton Miller

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=20051130130429.GB25032@flint.arm.linux.org.uk \
    --to=rmk+lkml@arm.linux.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sachinp@in.ibm.com \
    --cc=ssant@in.ibm.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

Powered by JetHome