From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: vtime accounting Date: Wed, 15 Mar 2017 09:30:48 +0100 Message-ID: <20170315083048.GI1277@cbox> References: <20170308105700.GA109453@lvm> <20170313162259.GE18298@potion> <20170314082601.GC1277@cbox> <20170314165858.GA5435@potion> <1d205be1-50ab-59cf-9908-dbbe8c939309@redhat.com> <20170314184133.GG1277@cbox> <91c3d503-952a-d376-b5d3-df64bc2b6332@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Radim =?utf-8?B?S3LEjW3DocWZ?= , Christoffer Dall , kvm@vger.kernel.org, Marc Zyngier , Rik van Riel To: Paolo Bonzini Return-path: Received: from mail-wr0-f174.google.com ([209.85.128.174]:35523 "EHLO mail-wr0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751145AbdCOIbC (ORCPT ); Wed, 15 Mar 2017 04:31:02 -0400 Received: by mail-wr0-f174.google.com with SMTP id g10so5845288wrg.2 for ; Wed, 15 Mar 2017 01:31:01 -0700 (PDT) Content-Disposition: inline In-Reply-To: <91c3d503-952a-d376-b5d3-df64bc2b6332@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 15, 2017 at 09:05:28AM +0100, Paolo Bonzini wrote: > > > 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. > I'll try to prototype it and see how it looks. > > 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 > > Good point, and if it's for statistics, this light change in behavior can hardly constitute any form of user breakage. Thanks, -Christoffer