[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Hight Processor time of Socket communciation

From: Peter Maydell
Subject: Re: [Qemu-devel] Hight Processor time of Socket communciation
Date: Wed, 19 Apr 2017 10:15:40 +0100

On 19 April 2017 at 09:56, Jiahuan Zhang <address@hidden> wrote:
> Do you mean that it is reasonable for QEMU emulation consumes high CPU time
> when doing host-guest interaction, since the interaction calls many QEMU
> codes in the background?

> Since my guest app is rather simple and no while() is included, according to
> your words,
> can I conclude that the high processor time is cause by the callbacks for
> guest to host data transfer?

What is happening is that the guest kernel's serial driver
has a loop that (simplified) looks like this:

  do {
      if (pl011_read(REG_FR) & FR_TXFF)
          break; /* fifo full, try again later */
      pl011_write(buffer[x], REG_DR);  /* send one byte */
  } while (x != len);

This is a lot of guest CPU instructions (and two callouts
to QEMU's device emulation) for every single byte.

>> You will likely get better throughput if you use the 'virt' board
>> where you can use the virtio-serial device which can send
>> data more efficiently.

> Here, can I understand your statement in this way,
> a transmit buffer in the serial device for guest to host data transfer
> may reduce the processor time, and in turn, increase the throughput?

The reason virtio-serial is faster is because the guest
kernel driver can essentially tell QEMU
 "the data is in guest memory at address X length L"
and then QEMU takes all that data at once. This is much
more efficient.

-- PMM

reply via email to

[Prev in Thread] Current Thread [Next in Thread]