From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jonathan Austin Subject: Re: [PATCH v2 2/3] kvm tools: remove periodic tick in favour of a polling thread Date: Wed, 04 Sep 2013 18:40:39 +0100 Message-ID: <52277097.8020008@arm.com> References: <1378301148-18823-1-git-send-email-jonathan.austin@arm.com> <1378301148-18823-3-git-send-email-jonathan.austin@arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Cc: KVM General , Marc Zyngier , Will Deacon , Matt Evans , Asias He , Sasha Levin To: Pekka Enberg Return-path: Received: from service87.mimecast.com ([91.220.42.44]:46194 "EHLO service87.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935174Ab3IDRlK convert rfc822-to-8bit (ORCPT ); Wed, 4 Sep 2013 13:41:10 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: Hi Pekka, On 04/09/13 16:58, Pekka Enberg wrote: > Hi Jonathan, > > On Wed, Sep 4, 2013 at 4:25 PM, Jonathan Austin wrote: >> Currently the only use of the periodic timer tick in kvmtool is to >> handle reading from stdin. Though functional, this periodic tick can be >> problematic on slow (eg FPGA) platforms and can cause low interactivity or >> even stop the execution from progressing at all. >> >> This patch removes the periodic tick in favour of a dedicated thread blocked >> waiting for input from the console. In order to reflect the new behaviour, >> the old 'kvm__arch_periodic_tick' function is renamed to 'kvm__arch_read_term'. >> >> Signed-off-by: Jonathan Austin >> Acked-by: Marc Zyngier > > I'm afraid this breaks "top" on x86. Does it work on arm? > Sorry about that... 'top' works on ARM with virtio console. I've just done some new testing and with the serial console emulation and I see the same as you're reporting. Previously with the 8250 emulation I'd booted to a prompt but didn't actually test top... I'm looking in to fixing this now... Looks like I need to find the right place from which to call serial8250_flush_tx now that it isn't getting called every tick. I've done the following and it works fixes 'top' with serial8250: -------8<---------- diff --git a/tools/kvm/hw/serial.c b/tools/kvm/hw/serial.c index 931067f..a71e68d 100644 --- a/tools/kvm/hw/serial.c +++ b/tools/kvm/hw/serial.c @@ -260,6 +260,7 @@ static bool serial8250_out(struct ioport *ioport, struct kvm *kvm, u16 port, dev->lsr &= ~UART_LSR_TEMT; if (dev->txcnt == FIFO_LEN / 2) dev->lsr &= ~UART_LSR_THRE; + serial8250_flush_tx(kvm, dev); } else { /* Should never happpen */ dev->lsr &= ~(UART_LSR_TEMT | UART_LSR_THRE); ------------->8----------- I guess it's a shame that we'll be printing each character (admittedly the rate will always be relatively low...) rather than flushing the buffer in a batch. Without a timer, though, I'm not sure I see a better option - every N chars doesn't seem like a good one to me. If you think that looks about right then I'll fold that in to the patch series, probably also removing the call to serial8250_flush_tx() in serial8250__receive. Thanks, Jonny