From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH] KVM: Create debugfs statistics for each VM Date: Mon, 1 Feb 2016 12:45:54 +0100 Message-ID: <56AF4572.6000606@de.ibm.com> References: <1453996159-19576-1-git-send-email-frankja@linux.vnet.ibm.com> <1453996159-19576-2-git-send-email-frankja@linux.vnet.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Cc: pbonzini@redhat.com, gleb@kernel.org, dan.carpenter@oracle.com To: Janosch Frank , kvm@vger.kernel.org Return-path: Received: from e06smtp07.uk.ibm.com ([195.75.94.103]:57681 "EHLO e06smtp07.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753641AbcBALqA (ORCPT ); Mon, 1 Feb 2016 06:46:00 -0500 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Feb 2016 11:45:59 -0000 Received: from b06cxnps4075.portsmouth.uk.ibm.com (d06relay12.portsmouth.uk.ibm.com [9.149.109.197]) by d06dlp01.portsmouth.uk.ibm.com (Postfix) with ESMTP id ADDE517D8059 for ; Mon, 1 Feb 2016 11:46:06 +0000 (GMT) Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u11BjtGC2163168 for ; Mon, 1 Feb 2016 11:45:55 GMT Received: from d06av01.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u11BjtFY023700 for ; Mon, 1 Feb 2016 04:45:55 -0700 In-Reply-To: <1453996159-19576-2-git-send-email-frankja@linux.vnet.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/28/2016 04:49 PM, Janosch Frank wrote: > KVM statistics for VMs (no. of exits, halts and other special > instructions) are currently only available in a summarized manner for > all VMs. They are exported to userland through files in the kvm > debugfs directory and used for performance monitoring, as well as VM > problem detection with helper tools like kvm_stat. If a VM has > problems and therefore creates a large number of exits, one can not > easily find out which one it is, as there is no VM specific data. > > This patch adds a kvm debugfs subdirectory for each VM, which is named > after its pid and file descriptor. They contain the same kind of files > that are already in the kvm debugfs directory, but the data that is > exported through them is now VM specific. > > CC: Dan Carpenter [includes fixes by Dan Carpenter] > Signed-off-by: Janosch Frank for s390: Tested-by: Christian Borntraeger some questions below [...] > > +/* Worst case buffer size needed for holding an integer. */ > +#define ITOA_MAX_LEN 12 4294967295 has 10, so this is to cover the \0 and a potential "-", correct? [...] > @@ -3436,7 +3602,8 @@ static int kvm_init_debug(void) > if (kvm_debugfs_dir == NULL) > goto out; > > - for (p = debugfs_entries; p->name; ++p) { > + kvm_debugfs_num_entries = 0; > + for (p = debugfs_entries; p->name; ++p, kvm_debugfs_num_entries++) { Looks like we cannot use ARRAY_SIZE(kvm_stats_debugfs_item), so unless somebody has a better idea we have to stick with kvm_debugfs_num_entries being calculated. > if (!debugfs_create_file(p->name, 0444, kvm_debugfs_dir, > (void *)(long)p->offset, > stat_fops[p->kind])) >