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

Re: IRQ latency measurements in hypervisor

  • To: Dario Faggioli <dfaggioli@xxxxxxxx>
  • From: Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Date: Thu, 21 Jan 2021 01:20:54 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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=vUWdYME0IjEaBsUwxHfINZmIRFil4/pLbRthi6rNoNY=; b=VYJ4y5xF7w+zT8gunDgVPchoJoH1ZnG2eoSg5crLrhgiSuuLaJ06nyj8ouMbYIW7sSlEKdAtsyDBNr4cNkI0rtrQ3qHbW91SOmlWDhuyb1ZsDgG78pgWJRnu1THZecK+iJH477h0YJep0tLQRgxNa2zN+wfo45MYWZ85eKE6JuYK5XrzGLqHeQXX5I9HnUIkRxeCsUn8FWtElEu8KMMoyVMdwvf+by8KtQQg02ZBavK96Us3llCw7WaJui0Bauw/gTTYJYCwI7DFlb2yf/YrpWZBPsnkHNSmP3GGFrXRzNkpgFKoBnXn4xserN0JgGy9TUNzyyQi3e+qUtLyS470hQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NeHwMBRoZRucNJMwbNfhLkLyshCnkNLfpAR7DQ8pzydScqr7Um8IpHDeSL3+hVT5gXyE727VAkQzretMGTuehvgPmQSuSpnI3Q6GsyELu7TkW/kb7ZxXRAV4wMnSOmeSKqzCGTrBcFuWpHqvfQnU1oBM/dgDSlovEyALTx2399p+4CAifgvlEchH0HYheXoYLM0D5g1SMZKsaCDr49RPyI219ZWROf1ygH6AXJ2MWCUVSGBlTT1MyA3oYBPP+20bWw7x2kOY3NDZn7PTRQ4kqN+UOmO6H17MHPu1yZUB8pijMOP3EcVJ9m7zqHqKmDc43gCxgxo7US54dzHKzCfbaA==
  • Authentication-results: suse.com; dkim=none (message not signed) header.d=none;suse.com; dmarc=none action=none header.from=epam.com;
  • Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Dario Faggioli <dario.faggioli@xxxxxxxx>, "Bertrand.Marquis@xxxxxxx" <Bertrand.Marquis@xxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>
  • Delivery-date: Thu, 21 Jan 2021 01:21:13 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHW6T1firbO0EOYpEKUiW6vsavsPaonyNIAgAXV/YCAA7YJAA==
  • Thread-topic: IRQ latency measurements in hypervisor

Hi Dario,

Dario Faggioli writes:

> On Thu, 2021-01-14 at 15:33 -0800, Stefano Stabellini wrote:
>> On Tue, 12 Jan 2021, Volodymyr Babchuk wrote:
>> > 2. RTDS scheduler. With console disabled, things like "hexdump -v
>> >    /dev/zero" didn't affected the latency so badly, but anyways,
>> >    sometimes I got ~600us spikes. This is not a surprise, because
>> > of
>> >    default RTDS configuration. I changed period for DomU from
>> > default
>> >    10ms to 100us and things got better: with Dom0 burning CPU I am
>> >    rarely getting max latency of about ~30us with mean latency of
>> > ~9us
>> >    and deviation of ~0.5us. On other hand, when I tried to set
>> > period
>> >    to 30us, max latency rose up to ~60us.
>> This is very interestingi too. Did you get any spikes with the period
>> set to 100us? It would be fantastic if there were none.
> This *probably* makes some sense. Where the *probably* comes from the
> fact that all the following reasoning assumes that what I recall about
> real-time scheduling theory is correct, on which I would not bet.
> Perhaps Stefano can ask to my good old friend Marko Bertogna, from the
> Univeristy of Modena, as they're collaborating on cache-coloring, what
> he his team think. He was already much better than me with this things,
> back in the days of the Ph.D... So for sure he's much better than me
> know! :-)
> Anyway, as I was saying, having a latency which is ~ 2x of your period
> is ok, and it should be expected (when you size the period). In fact,
> let's say that your budget is Xus, and your period is 30us. This means
> that you get to execute for Xus every 30us. So, basically, at time t0
> you are given a budget of Xus and you are guaranteed to be able to use
> it all within time t1=t0+30us. At that time (t1=t0+30us) you are given
> another Xus amount of budget, and you are guaranteed to be able to use
> it all within t2=t1+30us=t0+60us.

Well, I'm not sure if I got you right. Are you saying that unused budget
is preserved?

If I understood it correct, any unused budget is lost. So, basically
RDTS guarantees that your vcpu will able to run Xus in total every Yus,
where X is the budget and Y is the period. Also, it does not guarantee
that vCPU will be scheduled right away, so for period of 100us and
budget of 30us it will be perfectly fine to have latency of 70+us:

If at t=0 new period begins and in the same time IRQ fires, but RDTS
decides to run another task, it is possible that your vCPU will be
scheduled at only t=70us.

> Now, with a period as small as 30us, your budget is also going to be
> pretty small (how much was that? If it was in your mail, I must have
> missed it). Are you sure that the vCPU is able to wake up and run until
> the point that your driver has done all the latency measurement in
> _just_one_ instance (i.e., all this takes less than the budget)?.

> In fact, lat's say your budget is 10us, and it the vCPU needs 15us for
> waking up and doing the measurements. At time t0 the vCPU is scheduler,
> and let's say that the latency at that time is exactly 0. The vCPU
> start to run but, at time t0+10us (where 10us is the budget) it is
> stopped. at time t1=t0+30us, the vCPU receives a budget replenishment
> but that does not mean that it will start to run immediately, if the
> system is busy.
> In fact, what RTDS guarantees is that the vCPU will be able to execute
> for 10us within time t2=t1+30us. So, in theory, it can start to run as
> far as t2-10us, without violating any guarantee.
> If that is, in fact, what happens, i.e., the vCPU starts to run only at
> t2-10us, and it is only then that it manages to finish computing and
> recording the latency (after running for 5us more, as we said it takes
> 15us).
> What it will therefore record would be a latency to t2-5us, which in
> fact is:
>   t1 + 30us - 5us = t0 + 30us + 30us - 5us =
> = 0 + 60us - 5us = 55us ~= 60us
> So... May this be the case?

Yes, probably this is the issue. I used budget of 15us in this
case. But, taking into account that minimal observed latency is 3us and
typical is ~10us, it is quite possible that budget will be emptied
before IRQ handler will have a chance to complete.

It would be great to have priorities in RTDS, so more critical task can
preempt less critical one. I believe, I have seen corresponding patches

Volodymyr Babchuk at EPAM



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