Re: [patch 0/3] kvm tool: Serial emulation overhaul

From: James Courtier-Dutton
Date: Mon Dec 12 2011 - 16:03:13 EST


On 12 December 2011 18:40, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> -#define TIMER_INTERVAL_NS 1000000 Â Â Â/* 1 msec */
> +#define TIMER_INTERVAL_NS 10000000 Â Â /* 10 msec */
>
> serial console output slows down by the same 10x factor:
>
> real  Â0m24.631s
> user  Â0m0.007s
> sys   0m0.025s
>
> Lowering the interval too 100 usec speeds things up but unfortunately
> chokes the serial layer rather quickly:
>
>  Â8 root   ÂRT  [  Â6.759222] serial8250: too much work for irq4
> 0 Â Â 0 Â Â0 Â Â0 S Â0.0 Â0.0 Â 0:00.00 migration/1
>  Â9 root   Â20  0   0  Â0  Â0 S Â0.0 Â0.0  0:00.00 kworker/1:0
>  10 root   Â20  0   0  Â0  Â0 S Â0.0 Â0.0  0:00.00 ksoftirqd/1
>  11 root   Â20  0   0  Â0  Â0 S Â0.0 Â0.0  0:00.00 kworker/0:1
>  12 root   ÂRT  0   0  Â0  Â0 S Â0.0 Â0.0  0:00.00 watchdog/1
>  13 root   ÂRT  0   0  Â0  Â0 S Â0.0 Â0.0  0:00.00 migration/2
>  14 root   Â20  0   0  Â0  Â0 S Â0[  Â6.759222] serial8250:
> too much work for irq4
> .0 Â0.0 Â 0:00.00 kworker/2:0
>  15 root   Â20  0   0  Â0  Â0 S Â0.0 Â0.0  0:00.00 ksoftirqd/2
>
> So i'm pretty sure it's some bug in hw/serial.c that's limiting
> character output by interrupts.
>
Surely the system should be limiting the character output.
If the baud rate is set to 9600, the simulation of the serial port
should be slow.
If the baud rate is set to 115200, the simulation of the serial port
should be faster.
On real hardware, IO ports (outb/inb) are much slower than PCI memory mapped IO.
I am not sure if perceived slowness of kvm is by design or by accident though.

Now, if we want the guest serial console port to actually be fast, we
should let it be set to a baud of 921000 bps.
You could then use the nagle algorithm to improve its performance when
working in a kvm guest.

I have an application where when I set the guest serial port to 9600,
I want it to be slow, and be as close to real 9600 baud as possible.
--
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/