From mboxrd@z Thu Jan 1 00:00:00 1970 From: Janosch Frank Subject: Re: [PATCH] KVM: Create debugfs statistics for each VM Date: Mon, 1 Feb 2016 13:20:28 +0100 Message-ID: <56AF4D8C.7000802@linux.vnet.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> <56AF4572.6000606@de.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, frankja@linux.vnet.ibm.com To: Christian Borntraeger , kvm@vger.kernel.org Return-path: Received: from e06smtp06.uk.ibm.com ([195.75.94.102]:40975 "EHLO e06smtp06.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753671AbcBAMUe (ORCPT ); Mon, 1 Feb 2016 07:20:34 -0500 Received: from localhost by e06smtp06.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Feb 2016 12:20:32 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp02.portsmouth.uk.ibm.com (Postfix) with ESMTP id BC9F92190019 for ; Mon, 1 Feb 2016 12:20:16 +0000 (GMT) Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id u11CKTtJ4391242 for ; Mon, 1 Feb 2016 12:20:29 GMT Received: from d06av05.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id u11CKTh3030749 for ; Mon, 1 Feb 2016 05:20:29 -0700 In-Reply-To: <56AF4572.6000606@de.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On 02/01/2016 12:45 PM, Christian Borntraeger wrote: > 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? Correct For the dir name we have 2 * ITOA_MAX_LEN, as it is %d-%d an we only need one \0 which accounts for the additional hyphen. I'm open for suggestions about how to make this clearer. > > > [...] >> @@ -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])) >> >