From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: vtime accounting Date: Wed, 15 Mar 2017 09:05:28 +0100 Message-ID: <91c3d503-952a-d376-b5d3-df64bc2b6332@redhat.com> References: <20170308105700.GA109453@lvm> <20170313162259.GE18298@potion> <20170314082601.GC1277@cbox> <20170314165858.GA5435@potion> <1d205be1-50ab-59cf-9908-dbbe8c939309@redhat.com> <20170314184133.GG1277@cbox> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Cc: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Christoffer Dall , kvm@vger.kernel.org, Marc Zyngier , Rik van Riel To: Christoffer Dall Return-path: Received: from mx1.redhat.com ([209.132.183.28]:38962 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750780AbdCOIFb (ORCPT ); Wed, 15 Mar 2017 04:05:31 -0400 In-Reply-To: <20170314184133.GG1277@cbox> Sender: kvm-owner@vger.kernel.org List-ID: On 14/03/2017 19:41, Christoffer Dall wrote: > 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? > > Disclaimer: I haven't completely convinced myself that vtime accounting > from load/put works as it should. Me neither, but if it works, it's worth at least benchmarking it to make an informed decision. > For example, when servicing a VM from > KVM, should we really be accounting this as kernel time, or as guest > time? Servicing the request should be fast enough that it doesn't matter. For the most common x86 vmexits, 50% of the time is spent executing the x86 world switch microcode, and that is already being accounted as guest time already. On microbenchmarks of course it would make a difference: $ time ./x86/run x86/vmexit.flat -append cpuid -smp 4 [...] real 0m1.327s user 0m1.877s << this is really guest time sys 0m1.844s << this is spent mostly in KVM_RUN Paolo > 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?