From: Christian Borntraeger Subject: Re: [PATCH] kvm/stats: Update kvm stats to clear on write to their debugfs entry Date: Mon, 17 Oct 2016 15:48:19 +0200 Message-ID: <4b0284f4-161e-68ff-9942-9be9ff245f63@de.ibm.com> References: <1476424962-7610-1-git-send-email-sjitindarsingh@gmail.com> <20161017134004.GA8631@potion> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, pbonzini@redhat.com To: =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Suraj Jitindar Singh Return-path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57645 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757888AbcJQNsc (ORCPT ); Mon, 17 Oct 2016 09:48:32 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id u9HDhVWS039474 for ; Mon, 17 Oct 2016 09:48:26 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 264yj9s3qc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 17 Oct 2016 09:48:26 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 17 Oct 2016 14:48:23 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id 8C3EF2190023 for ; Mon, 17 Oct 2016 14:47:37 +0100 (BST) Received: from d06av06.portsmouth.uk.ibm.com (d06av06.portsmouth.uk.ibm.com [9.149.37.217]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u9HDmKvR13435050 for ; Mon, 17 Oct 2016 13:48:20 GMT Received: from d06av06.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av06.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u9HDmKHC012777 for ; Mon, 17 Oct 2016 09:48:20 -0400 In-Reply-To: <20161017134004.GA8631@potion> Sender: kvm-owner@vger.kernel.org List-ID: 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.