Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Jonathan Austin <jonathan.austin@arm.com>
To: Pekka Enberg <penberg@kernel.org>
Cc: KVM General <kvm@vger.kernel.org>,
	Marc Zyngier <Marc.Zyngier@arm.com>,
	Will Deacon <Will.Deacon@arm.com>,
	Matt Evans <Matt.Evans@arm.com>, Asias He <asias.hejun@gmail.com>,
	Sasha Levin <sasha.levin@oracle.com>
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	[thread overview]
Message-ID: <52277097.8020008@arm.com> (raw)
In-Reply-To: <CAOJsxLGs7-Quccv0cgBRqoAHpv=zjDpohaYgS4TCXZd20OFdOg@mail.gmail.com>

Hi Pekka,

On 04/09/13 16:58, Pekka Enberg wrote:
> Hi Jonathan,
> 
> On Wed, Sep 4, 2013 at 4:25 PM, Jonathan Austin <jonathan.austin@arm.com> 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 <jonathan.austin@arm.com>
>> Acked-by: Marc Zyngier <marc.zyngier@arm.com>
> 
> 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



  reply	other threads:[~2013-09-04 17:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 13:25 [PATCH v2 0/3] kvm tools: remove periodic tick Jonathan Austin
2013-09-04 13:25 ` [PATCH v2 1/3] kvm tools: use #define for maximum number of terminal devices Jonathan Austin
2013-09-04 13:25 ` [PATCH v2 2/3] kvm tools: remove periodic tick in favour of a polling thread Jonathan Austin
2013-09-04 15:58   ` Pekka Enberg
2013-09-04 17:40     ` Jonathan Austin [this message]
2013-09-04 17:48       ` Pekka Enberg
2013-09-04 18:01         ` Sasha Levin
2013-09-05 16:39           ` Jonathan Austin
2013-09-07 17:21             ` Sasha Levin
2013-09-04 13:25 ` [PATCH v2 3/3] kvm tools: stop virtio console doing unnecessary input handling Jonathan Austin

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=52277097.8020008@arm.com \
    --to=jonathan.austin@arm.com \
    --cc=Marc.Zyngier@arm.com \
    --cc=Matt.Evans@arm.com \
    --cc=Will.Deacon@arm.com \
    --cc=asias.hejun@gmail.com \
    --cc=kvm@vger.kernel.org \
    --cc=penberg@kernel.org \
    --cc=sasha.levin@oracle.com \
    /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