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 <dan.carpenter@xxxxxxxxxx> [includes fixes by Dan Carpenter] > Signed-off-by: Janosch Frank <frankja@xxxxxxxxxxxxxxxxxx> for s390: Tested-by: Christian Borntraeger <borntraeger@xxxxxxxxxx> 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])) > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html