[PATCH] powerpc: Make rtas console _much_ faster



Currently the hvc_rtas driver is painfully slow to use. Our "benchmark" is
ls -R /etc, which spits out about 27866 characters. The theoretical maximum
speed would be about 2.2 seconds, the current code takes ~50 seconds.

The core of the problem is that sometimes when the tty layer asks us to push
characters the firmware isn't able to handle some or all of them, and so
returns an error. The current code sees this and just returns to the tty code
with the buffer half sent.

The khvcd thread will eventually wake up and try to push more characters, which
will usually work because by then the firmware's had time to make room. But
the khvcd thread only wakes up every 10 milliseconds, which isn't fast enough.

So change the khvcd thread logic so that if there's an incomplete write we
yield() and then immediately try writing again. Doing so makes POLL_QUICK and
POLL_WRITE synonymous, so remove POLL_QUICK.

With this patch our "benchmark" takes ~2.8 seconds.

Signed-off-by: Michael Ellerman <michael@xxxxxxxxxxxxxx>
---

drivers/char/hvc_console.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

Index: cell/drivers/char/hvc_console.c
===================================================================
--- cell.orig/drivers/char/hvc_console.c
+++ cell/drivers/char/hvc_console.c
@@ -553,7 +553,6 @@ static int hvc_chars_in_buffer(struct tt

#define HVC_POLL_READ 0x00000001
#define HVC_POLL_WRITE 0x00000002
-#define HVC_POLL_QUICK 0x00000004

static int hvc_poll(struct hvc_struct *hp)
{
@@ -568,6 +567,7 @@ static int hvc_poll(struct hvc_struct *h
/* Push pending writes */
if (hp->n_outbuf > 0)
hvc_push(hp);
+
/* Reschedule us if still some write pending */
if (hp->n_outbuf > 0)
poll_mask |= HVC_POLL_WRITE;
@@ -680,7 +680,7 @@ int khvcd(void *unused)
poll_mask |= HVC_POLL_READ;
if (hvc_kicked)
continue;
- if (poll_mask & HVC_POLL_QUICK) {
+ if (poll_mask & HVC_POLL_WRITE) {
yield();
continue;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: file of exact size
    ... standard C by, for example, creating the file and writing that number ... of characters. ... The benchmark to beat is eight minutes. ...
    (comp.lang.c)
  • [PATCH 1/3] powerpc: Make rtas console _much_ faster
    ... Currently the hvc_rtas driver is painfully slow to use. ... which spits out about 27866 characters. ... The core of the problem is that sometimes when the tty layer asks us to push ... With this patch the "benchmark" takes ~2.8 seconds. ...
    (Linux-Kernel)
  • Re: Go to Low Power until I receive Data from a COM port
    ... Attach the Rx line to an interrupt that is set to wake the processor ... (through circuitry to adjust the level and protect from ESD or course). ... may still lose a few characters but it'll wake you. ...
    (microsoft.public.windowsce.embedded.vc)
  • Re: Counting characters in text file and adding carriage return
    ... Paul Lalli wrote: ... A benchmark would be interesting here. ... it doesn't have to replace 80% of the characters with themselves. ... \n (newlines are characters too!) ...
    (perl.beginners)