All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Jiahuan Zhang <jiahuanzhang90@gmail.com>
Cc: QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] Hight Processor time of Socket communciation
Date: Wed, 19 Apr 2017 10:55:29 +0100	[thread overview]
Message-ID: <CAFEAcA9mfnUF-ZtU+kGpSj2LqVxPi=0GLB4Jk9zLnhhfq_Su4A@mail.gmail.com> (raw)
In-Reply-To: <CAJy91CY=s2H0VYYuDUrs=HYTEKjKZHpU1MXrhStxGxxWg=hfEg@mail.gmail.com>

On 19 April 2017 at 10:25, Jiahuan Zhang <jiahuanzhang90@gmail.com> wrote:
> On 19 April 2017 at 11:15, Peter Maydell <peter.maydell@linaro.org> wrote:
>> 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 */
>>       x++;
>>   } while (x != len);
>>
>> This is a lot of guest CPU instructions (and two callouts
>> to QEMU's device emulation) for every single byte.
>>
> Hi, no, I am not using any kernel driver and I only test the guest to host
> data transfer.

OK, then the equivalent loop is this one:

> /*
>  * write_to_uart(): write data to serial port
>  */
> void write_to_uart(char* out, uint32_t writeSize){
>  int i;
>  for(i=0; i<writeSize; i++){
>   *UART1 =(unsigned char)(*(out+i));
>  }
> }

except that your code is broken because it's not
checking that the FIFO is ready to receive the character
so it will drop data sometimes.

The point is the same -- you're feeding the data to
the UART byte-at-a-time.

thanks
-- PMM

  reply	other threads:[~2017-04-19  9:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-18 16:19 [Qemu-devel] Hight Processor time of Socket communciation Jiahuan Zhang
2017-04-18 16:26 ` Peter Maydell
2017-04-19  8:56   ` Jiahuan Zhang
2017-04-19  9:15     ` Peter Maydell
2017-04-19  9:25       ` Jiahuan Zhang
2017-04-19  9:55         ` Peter Maydell [this message]
2017-04-19 10:04           ` Jiahuan Zhang
2017-04-19 10:09             ` Peter Maydell
2017-04-19 13:34               ` Jiahuan Zhang
2017-04-19 20:03                 ` Peter Maydell

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='CAFEAcA9mfnUF-ZtU+kGpSj2LqVxPi=0GLB4Jk9zLnhhfq_Su4A@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=jiahuanzhang90@gmail.com \
    --cc=qemu-devel@nongnu.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.