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

Re: [Xen-devel] [RFC 1/6] xen/arm: Re-enable interrupt later in the trap path

  • To: "andrii.anisov@xxxxxxxxx" <andrii.anisov@xxxxxxxxx>, "julien.grall@xxxxxxx" <julien.grall@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Dario Faggioli <dfaggioli@xxxxxxxx>
  • Date: Sat, 3 Aug 2019 00:55:55 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=suse.com;dmarc=pass action=none header.from=suse.com;dkim=pass header.d=suse.com;arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aFxVk73reNyV2C+mUwGLr27usUX0FLM0Fx9h1AzskXU=; b=PrQXMZfaoRHI2OhxaWLwaMHWrpElhLIj9P3Bbsu5jIKWB1RD6RSQmuaMISZ5a3mPIS9IgVZVDubr6eJ2YpPN9xhSFFf6aAcaxOAl95RMya6z8GAS6quoCBsLve6uHWJyNcHRVJdaVzk2u6XyOWlG7BCuB0zGKBeoO6CFONj4VcVeOCST16JwEXsHsfbvmEdGgi0BaX8JQpVuk+jdLog1Ra3VkPugJbVxqIu/GrbqrqrJLhLoTwtd1L2qEhUX0nfXpHa6K/OkyTUFCzdQuLII4VLhXfLjoKcda+7SscTb4aTffkXjuVlWSPUCqaRvMre5K2LmcqkHB/3HooGQk5qbkg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=P2vzEtsfLl6H+3Fg5r5Pel6Kb7WRO0Td+ty1o+nGuwwdU7V+I9SMWQujelImzSZRF+wRM+iqqZ2PpMVtVtjct6sCP/Gqk/XLDiDEjnSHG8+NqM+Gol0O4KF2D7H4Odw3uoUo4guHjdEQQ2ypeRCx6V6KbK6KTdngZ09HfbUzAaf6QxZzwQR+Yf0bVD/zTjD/KekYeW3AHQB7nr8HHD0JxXtb8s9Wg7E1mtL0xkTwevv3VW4wPlSD41ROTT4cfvU4aSWedzpatOPtVY2z0rPUrW1B83X9lQSy7KN7DY+00U0b0MJrRv8EpA8nh454XAM+Jx9PnwsVO7EuoFH6J++agg==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=dfaggioli@xxxxxxxx;
  • Cc: "andrii_anisov@xxxxxxxx" <andrii_anisov@xxxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "Volodymyr_Babchuk@xxxxxxxx" <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Sat, 03 Aug 2019 00:56:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVSQcBz01X1+GS1EGqbA6JcY+nvabnk6IDgABBB2OAAMWuAA==
  • Thread-topic: [Xen-devel] [RFC 1/6] xen/arm: Re-enable interrupt later in the trap path

On Fri, 2019-08-02 at 16:07 +0300, Andrii Anisov wrote:
> On 02.08.19 12:15, Julien Grall wrote:
> >  From the list below it is not clear what is the split between
> > hypervisor time and guest time. See some of the examples below.
> I guess your question is *why* do I split hyp/guest time in such a
> way.
> So for the guest I count time spent in the guest mode. Plus time
> spent in hypervisor mode to serve explicit requests by guest.
From an accuracy, but also from a fairness perspective:
- what a guest does directly (in guest mode)
- what the hypervisor does, on behalf of a guest, no matter whether
requested explicitly or not
should all be accounted to the guest. In the sense that the guest
should be charged for it.

Actually, the concepts of "guest time" and "hypervisor time" are
actually orthogonal from the accounting, at least ideally.

In fact, when a guest does an hypercall, the time that we spend inside
Xen for performing the hypercal itself:
* is hypervisor time
* the guest that did the hypercall should be charged for it.

If we don't charge the guest for these activity, in theory, a guest can
start doing a lot of hypercalls and generating a lot of interrupts...
since most of the time is spent in the hypervisor, it's runtime (from
the scheduler point of view) increase only a little, and the scheduler
will continue to run it, and it will continue to generate hypercalls
and interrupts, until it starve/DoS the system!

In fact, this right now can't happen because we always charge guests
for the time spent doing these things. The problem is that we often
charge _the_wrong_ guest. This somewhat manages to prevent (or make it
very unlikely) a DoS situation, but is indeed unfair, and may cause
problems (especially in RT scenarios).

> That time may be quite deterministic from the guest's point of view.
> But the time spent by hypervisor to handle interrupts, update the
> hardware state is not requested by the guest itself. It is a
> virtualization overhead. 
Yes, but still, when it is the guest that causes such overhead, it is
important that the guest itself gets to pay for it.

Just as an example (although you don't have this problem on ARM), if I
have an HVM, ideally I would charge to the guest the time that QEMU
executes in dom0!

On the other hand, the time that we spend in the scheduler, for
instance, doing load balancing among the various runqueues, or the time
that we spend in Xen (on x86) for time synchronization rendezvouses,
they should not be charged to any guest.

> And the overhead heavily depends on the system configuration (e.g.
> how many guests are running).
> That overhead may be accounted for a guest or for hyp, depending on
> the model agreed.
Load balancing within the scheduler, indeed depends on how busy the
system is, and I agree that time should be accounted against any guest.

Saving and restoring the register state of a guest, I don't think it
depends on how many other guests there are around, and I think should
be accounted against the guest itself.

> My idea is as following:
> Accounting that overhead for guests is quite OK for server
> applications, you put server overhead time on guests and charge money
> from their budget.
I disagree. The benefits of more accurate and correct time accounting
and charging are not workload or use case dependent. If we decide to
charge the guest for hypercalls it does and interrupts it receives,
then we should do that, both for servers and for embedded RT systems.

> Yet for RT applications you will have more accurate view on the guest
> execution time if you drop that overhead.

> Our target is XEN in safety critical systems. So I chosen more
> deterministic (from my point of view) approach.
As said, I believe this is one of those cases, where we want an unified
approach. And not because it's easier, or because "Xen has to work both
on servers and embedded" (which, BTW, is true). But because it is the
right thing to do, IMO.

> Well, I suppose we may add granularity to the time accounting, and
> then decide at the scheduler level what we count for the guest
> execution time.
> But it is so far from the end, and we are here to discuss and agree
> the stuff.
Indeed. :-)

Dario Faggioli, Ph.D
Virtualization Software Engineer
SUSE Labs, SUSE https://www.suse.com/
<<This happens because _I_ choose it to happen!>> (Raistlin Majere)

Attachment: signature.asc
Description: This is a digitally signed message part

Xen-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.