From: Christoffer Dall <cdall@linaro.org>
To: "Radim Krčmář" <rkrcmar@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Christoffer Dall <christoffer.dall@linaro.org>,
kvm@vger.kernel.org, Marc Zyngier <marc.zyngier@arm.com>,
Rik van Riel <riel@redhat.com>
Subject: Re: vtime accounting
Date: Tue, 14 Mar 2017 21:01:47 +0100 [thread overview]
Message-ID: <20170314200147.GH1277@cbox> (raw)
In-Reply-To: <20170314193201.GC5432@potion>
On Tue, Mar 14, 2017 at 08:32:02PM +0100, Radim Krčmář wrote:
> 2017-03-14 19:41+0100, Christoffer Dall:
> > On Tue, Mar 14, 2017 at 06:09:45PM +0100, Paolo Bonzini wrote:
> >> On 14/03/2017 17:58, Radim Krčmář wrote:
> >> >> I assume there's a good reason why we call guest_enter() and
> >> >> guest_exit() in the hot path on every KVM architecture?
> >> > I consider myself biased when it comes to jiffies, so no judgement. :)
> >> >
> >> > From what I see, the mode switch is used only for statistics.
> >>
> >> vtime is only for statistics, but guest_enter/exit are important because
> >> they enter an RCU extended quiescent state. This means that (physical)
> >> CPUs running a guest are effectively "off" from the point of view of the
> >> RCU accounting machinery. Not having to perform any RCU work is very
> >> good for jitter.
>
> Ah, good point.
>
> > So would it be worth considering factoring out vtime accounting from
> > guest_enter/exit, such that we could do the vtime accounting from vcpu
> > load/put and mark the RCU extended quiescent state in the run loop?
>
> RCU is the reason why guest_exit() needs disabled interrupts, so if we
> split them, we could do rcu_virt_note_context_switch() before enabling
> interrupts, and guest_exit() right after.
>
I'm not convinced that what you're saying is true ;)
I think we only fiddle with RCU during guest_enter, and further, a trace
of guest_exit reveals:
guest_exit_irqoff
-> vtime_guest_exit
-> __vtime_account_system
-> get_vtime_delta
-> account_other_time
-> WARN_ON_ONCE(!irqs_disabled());
So I think we do need interrupts disabled when messing with vtime?
> > Disclaimer: I haven't completely convinced myself that vtime accounting
> > from load/put works as it should. For example, when servicing a VM from
> > KVM, should we really be accounting this as kernel time, or as guest
> > time? I think we do the former now, but if the latter is the right
> > thing, would changing the behavior constitute an ABI change to
> > userspace?
>
> Not considering that option would be best. :)
If my statement above about needing interrupts disabled when dealing
with vtime, then considering this begins to sound interesting, also
given that the vtime thing is not entirely free and we're dealing with
the hot path of receiving IPIs here, for example.
Thanks,
-Christoffer
next prev parent reply other threads:[~2017-03-14 20:02 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-08 10:57 vtime accounting Christoffer Dall
2017-03-09 8:16 ` Paolo Bonzini
2017-03-13 17:28 ` Radim Krčmář
2017-03-14 8:26 ` Christoffer Dall
2017-03-14 8:55 ` Marc Zyngier
2017-03-14 11:12 ` Christoffer Dall
2017-03-14 11:46 ` Marc Zyngier
2017-03-14 16:58 ` Radim Krčmář
2017-03-14 17:09 ` Paolo Bonzini
2017-03-14 18:41 ` Christoffer Dall
2017-03-14 19:32 ` Radim Krčmář
2017-03-14 20:01 ` Christoffer Dall [this message]
2017-03-14 21:52 ` Radim Krčmář
2017-03-15 8:09 ` Paolo Bonzini
2017-03-15 8:05 ` Paolo Bonzini
2017-03-15 8:30 ` Christoffer Dall
2017-03-14 18:39 ` Christoffer Dall
2017-03-14 20:27 ` Radim Krčmář
2017-03-14 21:53 ` Radim Krčmář
2017-03-15 8:43 ` Christoffer Dall
2017-03-15 15:57 ` Radim Krčmář
2017-03-15 16:48 ` Christoffer Dall
2017-03-15 17:09 ` Radim Krčmář
2017-03-24 15:04 ` Rik van Riel
2017-03-27 12:29 ` Wanpeng Li
2017-03-24 14:55 ` Rik van Riel
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=20170314200147.GH1277@cbox \
--to=cdall@linaro.org \
--cc=christoffer.dall@linaro.org \
--cc=kvm@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=pbonzini@redhat.com \
--cc=riel@redhat.com \
--cc=rkrcmar@redhat.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox