From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christoffer Dall Subject: Re: vtime accounting Date: Tue, 14 Mar 2017 19:41:33 +0100 Message-ID: <20170314184133.GG1277@cbox> References: <20170308105700.GA109453@lvm> <20170313162259.GE18298@potion> <20170314082601.GC1277@cbox> <20170314165858.GA5435@potion> <1d205be1-50ab-59cf-9908-dbbe8c939309@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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-f178.google.com ([209.85.128.178]:33901 "EHLO mail-wr0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751102AbdCNSlq (ORCPT ); Tue, 14 Mar 2017 14:41:46 -0400 Received: by mail-wr0-f178.google.com with SMTP id l37so130051421wrc.1 for ; Tue, 14 Mar 2017 11:41:45 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1d205be1-50ab-59cf-9908-dbbe8c939309@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: 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. > 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. 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? Thanks, -Christoffer