mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fengwei Yin <yfw.kernel@gmail.com>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] tty: Sort out the USB sysrq changes that wrecked  performance
Date: Thu, 9 Jul 2009 23:49:46 +0800	[thread overview]
Message-ID: <ab18d8520907090849p14d3c48eub6d01bdfd750cdf5@mail.gmail.com> (raw)
In-Reply-To: <20090709123523.15654.15754.stgit@localhost.localdomain>

Hi Alan,

On Thu, Jul 9, 2009 at 8:35 PM, Alan Cox<alan@lxorguk.ukuu.org.uk> wrote:
> From: Alan Cox <alan@linux.intel.com>
>
> We can't go around calling all sorts of magic per character functions at
> full rate 3G data speed.
>
> Signed-off-by: Alan Cox <alan@linux.intel.com>
> ---
>
>  drivers/usb/serial/generic.c |   15 +++++++++++----
>  1 files changed, 11 insertions(+), 4 deletions(-)
>
>
> diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
> index 932d624..e9aa7a4 100644
> --- a/drivers/usb/serial/generic.c
> +++ b/drivers/usb/serial/generic.c
> @@ -424,10 +424,17 @@ static void flush_and_resubmit_read_urb(struct usb_serial_port *port)
>        if (!tty)
>                goto done;
>
> -       /* Push data to tty */
> -       for (i = 0; i < urb->actual_length; i++, ch++) {
> -               if (!usb_serial_handle_sysrq_char(port, *ch))
> -                       tty_insert_flip_char(tty, *ch, TTY_NORMAL);
> +       /* The per character mucking around with sysrq path it too slow for
> +          stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases
> +          where the USB serial is not a console anyway */
> +       if (!port->console || !port->sysrq)
> +               tty_insert_flip_string(tty, ch, urb->actual_length);
> +       else {
> +               /* Push data to tty */
> +               for (i = 0; i < urb->actual_length; i++, ch++) {
> +                       if (!usb_serial_handle_sysrq_char(port, *ch))
> +                               tty_insert_flip_char(tty, *ch, TTY_NORMAL);
> +               }
>        }
>        tty_flip_buffer_push(tty);
>        tty_kref_put(tty);
>

What about the change like this:

diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c
index 932d624..b4fd33b 100644
--- a/drivers/usb/serial/generic.c
+++ b/drivers/usb/serial/generic.c
@@ -424,10 +424,26 @@ static void flush_and_resubmit_read_urb(struct
usb_serial_port *port)
 	if (!tty)
 		goto done;

-	/* Push data to tty */
-	for (i = 0; i < urb->actual_length; i++, ch++) {
-		if (!usb_serial_handle_sysrq_char(port, *ch))
-			tty_insert_flip_char(tty, *ch, TTY_NORMAL);
+        /* The per character mucking around with sysrq path it too slow for
+           stuff like 3G modems, so shortcircuit it in the 99.9999999% of cases
+           where the USB serial is not a console anyway */
+        if (!port->console || !port->sysrq)
+                tty_insert_flip_string(tty, ch, urb->actual_length);
+        else {
+		/*
+		 * Most of data shouldn't be sysrq request even when
+		 * tty is a printk console.
+		 */
+		if (time_before(jiffies, port->sysrq)) {
+			/* Push data to tty */
+			for (i = 0; i < urb->actual_length; i++, ch++) {
+				if (!usb_serial_handle_sysrq_char(port, *ch))
+					tty_insert_flip_char(tty, *ch,
+							TTY_NORMAL);
+			}
+		} else {
+			tty_insert_flip_string(tty, ch, urb->actual_length);
+		}
 	}
 	tty_flip_buffer_push(tty);
 	tty_kref_put(tty);


Regards
Yin, Fengwei

> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>

  reply	other threads:[~2009-07-09 15:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-09 12:35 [PATCH 0/3] Fix sysrq caused USB performance regressions and leak Alan Cox
2009-07-09 12:35 ` [PATCH 1/3] tty: Sort out the USB sysrq changes that wrecked performance Alan Cox
2009-07-09 15:49   ` Fengwei Yin [this message]
2009-07-09 23:22     ` Fengwei Yin
2009-07-09 12:36 ` [PATCH 2/3] tty: Fix USB kref leak Alan Cox
2009-07-09 12:36 ` [PATCH 3/3] tty: Fix the PL2303 private methods for sysrq Alan Cox
2009-07-09 15:46 ` [PATCH 0/3] Fix sysrq caused USB performance regressions and leak Anders Larsen
2009-07-10  0:02   ` Alan Cox
2009-07-10  9:07     ` Anders Larsen
2009-07-10  9:34       ` Alan Cox

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=ab18d8520907090849p14d3c48eub6d01bdfd750cdf5@mail.gmail.com \
    --to=yfw.kernel@gmail.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®