Re: [patch 0/3] kvm tool: Serial emulation overhaul
From: Pekka Enberg
Date: Mon Dec 12 2011 - 14:14:27 EST
On Mon, Dec 12, 2011 at 7:20 PM, Ingo Molnar <mingo@xxxxxxx> wrote:
>>> I'm seeing 1.5 usecs per character for this little benchmark:
>>
>> Interesting - what do you see with the top -b measurement i
>> posted - can you see similar slowdowns?
On Mon, Dec 12, 2011 at 8:40 PM, Pekka Enberg <penberg@xxxxxxxxxx> wrote:
> ssh-4.2# time top -d 0.01 -n 10 -b
>
> [snip]
>
> real 0m2.935
> user 0m0.006s
> sys 0m0.049s
>
> That's 9.7 usecs per character which is roughly 6x slowdown.
>
> It seems to be related to interrupt handling because if I bump up
> TIMER_INTEVAL_NS to 10 msec:
[snip]
Looking at drivers/tty/serial/8250.c, we have:
static void serial8250_console_putchar(struct uart_port *port, int ch)
{
struct uart_8250_port *up =
container_of(port, struct uart_8250_port, port);
wait_for_xmitr(up, UART_LSR_THRE);
serial_out(up, UART_TX, ch);
}
in tools/kvm/hw/serial.c::serial8250_out() we do:
case UART_TX:
if (!(dev->lcr & UART_LCR_DLAB)) {
char *addr = data;
if (!(dev->mcr & UART_MCR_LOOP))
term_putc(CONSOLE_8250, addr, size, dev->id);
/* else FIXME: Inject data into rcv path for LOOP */
if (++dev->txcnt == 16)
dev->lsr &= ~(UART_LSR_TEMT | UART_LSR_THRE);
break;
which clears UART_LSR_THRE after 16 characters. UART_LSR_THRE is only
enabled in serial8250__update_consoles() and serial8250_update_irq()
which are completely bound by TIMER_INTERVAL_NS.
Pekka
--
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/