All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@arm.com>
To: Bhupinder Thakur <bhupinder.thakur@linaro.org>,
	Stefano Stabellini <sstabellini@kernel.org>
Cc: xen-devel@lists.xenproject.org, nd@arm.com,
	Ian Jackson <ian.jackson@eu.citrix.com>,
	Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH 01/10] xen/arm: vpl011: Add pl011 uart emulation in Xen
Date: Wed, 26 Apr 2017 09:13:11 +0100	[thread overview]
Message-ID: <3d713998-6558-61ab-d749-52ff6787718a@arm.com> (raw)
In-Reply-To: <CACtJ1JQ+fgig8Y4BpQQvauifUD5bg0ghmshmfgtd6a7G1m=k_g@mail.gmail.com>

Hi Bhupinder,

On 26/04/2017 08:49, Bhupinder Thakur wrote:
>>>> Regarding the optimization you introduced in this patch, delaying write
>>>> notifications until we receive a notification from xenconsoled, how many
>>>> notifications from xen to xenconsoled does it actually save? xenconsoled
>>>> is going to send a notification for every read: we might end up sending
>>>> the same number of notifications, only delayed.
>>>>
>>>>
>>> In the PV console design, the events from the guest are sent to
>>> xenconsole for every chunk of data. Since in the pl011 emulation, the
>>> data comes in bytes only, it would generate lot of events to
>>> xenconsole. To reduce the flurry of events, this optimisation was
>>> added.
>>>
>>> Xenconsole sends an event in the following conditions:
>>>
>>> 1. There is data available for Xen to process
>>> 2. It has finished processing the data and Xen can send more data
>>>
>>> In the 2nd case, xenconsole will keep reading the data from the ring
>>> buffer until it goes empty. At that point, it would send an event to
>>> Xen. Between sending of this event and processing of this event by
>>> Xen, there could be more data added for the xenconsole to process.
>>> While handling an event, the Xen will check for that condition and if
>>> there is data to be processed by xenconsole, it would send an event.
>>>
>>> Also sending delayed events helps with the rate limit check in
>>> xenconsole. If there are too many events, they maybe masked by
>>> xenconsole. I could test whether this rate limit check is really
>>> getting hit with and without this optimisation.
>>
>> I understand the idea behind, my question is whether this approach was
>> actually verified by any scientific measurements. Did you run a test
>> to count how many notifications were skipped thanks to this
>> optimization? If so, what was the scenario? How many notifications were
>> saved? If you didn't run a test, I suggest you do :-)
>>
> Today I did some instrumentation and count the number of events sent
> by Xen to xenconsole and how many are really processed by xenconsole.
>
> I could not see any difference in the number of events processed by
> xenconsole with or without the optimization. The total number of
> events processed by xenconsole were about 500 for the complete guest
> booting till the login prompt (for both optimised and non-optimised
> case).
>
> Although Xen calls notify_via_xen_event_channel() far more number of
> times (about 12000 times until the guest loging prompt comes) without
> the optimisation, it does not translate into sending those many events
> to xenconsole though. With the optmization it just reduces the number
> of times notify_via_xen_event_channel() is called which is about 500
> times.
>
> I believe the reason could be that if the event is still pending with
> xenconsole when the next event comes via
> notify_via_xen_event_channel() then all such events would be coalesced
> and delivered to xenconsole as a single event.
>
> So the optimization does not help with saving any processing on
> xenconsole though it saves the overhead of calling
> notify_via_xen_event_channel() very frequently in Xen.

I don't see any issue to call notify_via_xen_event_channel many time 
because you should do it for every batch sent.

Yes, the batch consists only of one character, but this is how an UART 
is designed.

You rely on the behavior of notify_via_xen_event_channel. What if in the 
future it changes? Then maybe, you will miss event and data.

So I would rather avoid this premature optimization and see how it is 
behaving. If it is too slow, then we can think about it.

Cheers,

-- 
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-04-26  8:13 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-03  9:44 [PATCH 00/10] pl011 emulation support in Xen Bhupinder Thakur
2017-04-03  9:44 ` [PATCH 01/10] xen/arm: vpl011: Add pl011 uart emulation " Bhupinder Thakur
2017-04-12 16:32   ` Wei Liu
2017-04-19  0:15   ` Stefano Stabellini
2017-04-19  7:28     ` Bhupinder Thakur
2017-04-19  8:36       ` Julien Grall
2017-04-19 18:40       ` Stefano Stabellini
2017-04-25  7:31         ` Bhupinder Thakur
2017-04-25 17:56           ` Stefano Stabellini
2017-04-26  7:49             ` Bhupinder Thakur
2017-04-26  8:13               ` Julien Grall [this message]
2017-04-26 17:03                 ` Stefano Stabellini
2017-04-03  9:44 ` [PATCH 02/10] xen/arm: vpl011: Add new virtual console hvm params " Bhupinder Thakur
2017-04-19  0:22   ` Stefano Stabellini
2017-04-19  8:48     ` Bhupinder Thakur
2017-04-03  9:44 ` [PATCH 03/10] xen/arm: vpl011: Enable pl011 emulation for a guest domain " Bhupinder Thakur
2017-04-19  0:27   ` Stefano Stabellini
2017-04-03  9:44 ` [PATCH 04/10] xen/arm: vpl011: Provide a knob in libxl to enable/disable pl011 emulation Bhupinder Thakur
2017-04-12 16:32   ` Wei Liu
2017-04-13  8:19     ` Bhupinder Thakur
2017-04-13  8:37       ` Wei Liu
2017-04-19  0:29         ` Stefano Stabellini
2017-04-19  9:17           ` Bhupinder Thakur
2017-04-19 10:25             ` Wei Liu
2017-04-19 11:06               ` Julien Grall
2017-04-03  9:44 ` [PATCH 05/10] xen/arm: vpl011: Allocate a new PFN in the toolstack for the virtual console Bhupinder Thakur
2017-04-12 16:33   ` Wei Liu
2017-04-13  8:37     ` Bhupinder Thakur
2017-04-13  8:53       ` Wei Liu
2017-04-19  0:36         ` Stefano Stabellini
2017-04-19 10:28           ` Wei Liu
2017-04-19 11:01             ` Julien Grall
2017-04-19 13:05               ` Bhupinder Thakur
2017-04-19 13:35                 ` Julien Grall
2017-04-03  9:44 ` [PATCH 06/10] xen/arm: vpl011: Add new parameters to xenstore " Bhupinder Thakur
2017-04-12 16:32   ` Wei Liu
2017-04-25 10:18     ` Bhupinder Thakur
2017-04-25 11:55       ` Wei Liu
2017-04-19 18:58   ` Stefano Stabellini
2017-04-03  9:44 ` [PATCH 07/10] xen/arm: vpl011: Add a new console type to domain structure in xenconsole Bhupinder Thakur
2017-04-12 16:33   ` Wei Liu
2017-04-13  9:49     ` Bhupinder Thakur
2017-04-19 19:09   ` Stefano Stabellini
2017-04-03  9:44 ` [PATCH 08/10] xen/arm: vpl011: Modify the APIs in xenconsole to acces both PV and VCON consoles Bhupinder Thakur
2017-04-12 16:33   ` Wei Liu
2017-04-24 14:52     ` Bhupinder Thakur
2017-04-03  9:44 ` [PATCH 09/10] xen/arm: vpl011: Add new virtual console to xenconsole client Bhupinder Thakur
2017-04-19 18:55   ` Stefano Stabellini
2017-04-03  9:44 ` [PATCH 10/10] xen/arm: vpl011: Add a pl011 uart DT node in the guest device tree Bhupinder Thakur
2017-04-19 18:53   ` Stefano Stabellini
2017-04-20 12:47 ` [PATCH 00/10] pl011 emulation support in Xen Julien Grall
2017-04-26 15:21   ` Bhupinder Thakur
2017-04-26 17:09     ` Stefano Stabellini

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=3d713998-6558-61ab-d749-52ff6787718a@arm.com \
    --to=julien.grall@arm.com \
    --cc=bhupinder.thakur@linaro.org \
    --cc=ian.jackson@eu.citrix.com \
    --cc=nd@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.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.