From mboxrd@z Thu Jan 1 00:00:00 1970 From: Suraj Jitindar Singh Subject: Re: [PATCH] kvm/stats: Update kvm stats to clear on write to their debugfs entry Date: Tue, 18 Oct 2016 18:18:35 +1100 Message-ID: <1476775115.2150.11.camel@gmail.com> References: <1476424962-7610-1-git-send-email-sjitindarsingh@gmail.com> <20161017134004.GA8631@potion> <4b0284f4-161e-68ff-9942-9be9ff245f63@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, pbonzini@redhat.com To: Christian Borntraeger , Radim =?UTF-8?Q?Kr=C4=8Dm=C3=A1=C5=99?= Return-path: Received: from mail-pf0-f193.google.com ([209.85.192.193]:35996 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758234AbcJRHSl (ORCPT ); Tue, 18 Oct 2016 03:18:41 -0400 Received: by mail-pf0-f193.google.com with SMTP id r16so14379367pfg.3 for ; Tue, 18 Oct 2016 00:18:41 -0700 (PDT) In-Reply-To: <4b0284f4-161e-68ff-9942-9be9ff245f63@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, 2016-10-17 at 15:48 +0200, Christian Borntraeger wrote: > On 10/17/2016 03:40 PM, Radim Krčmář wrote: > > > > 2016-10-14 17:02+1100, Suraj Jitindar Singh: > > > > > > Various kvm vm and vcpu stats are provided via debugfs entries. > > > Currently there is no way to reset these stats back to zero for > > > the system > > > except by stopping all vms. > > It is not really resetting, just a special case of current behavior > > -- > > top-level stats are a sum of all existing VMs/VCPUs, so we would > > see 0 > > if they all had 0. > > > > > > > > Add the ability to clear (reset back to zero) these stats on a > > > per stat > > > basis by writing to the debugfs files. > > I can see this being used before a test, but the userspace could > > also > > read the value instead of writing and subtract it from the value > > after > > the test to get a similar result. > > > > The userspace-only solution is insufficient? > > > > When and what do you zero? > > > > > > > >                                        The stats are just reset > > > to zero > > > irrespective of what is actually written to the file. > > Sounds good.  Setting the val would be as simple, but there > > shouldn't be > > a reason to and it is a debug interface, so we can change it > > anytime. > > > > > > > > Signed-off-by: Suraj Jitindar Singh > > > --- > > I have applied it to kvm/queue for the moment, thanks. > FWIW, I was thinking about another change: provide the accumulated > values of  > the counters of all VMs that have been destroyed (basically on > vm_destroy read > the values and add them on top of the "forever" counters. > Did not find the time to do something like this. This doesn't seem like it would be particularly hard to implement, I'm just not sure of the use case. > > >