KVM: Create debugfs dir and stat files for each VM

This patch adds a kvm debugfs subdirectory for each VM, which is named
after its pid and file descriptor. The directories contain the same
kind of files that are already in the kvm debugfs directory, but the
data exported through them is now VM specific.

This makes the debugfs kvm data a convenient alternative to the
tracepoints which already have per VM data. The debugfs data is easy
to read and low overhead.

CC: Dan Carpenter <dan.carpenter@oracle.com> [includes fixes by Dan Carpenter]
Signed-off-by: Janosch Frank <frankja@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Janosch Frank
2016-05-18 13:26:23 +02:00
committed by Paolo Bonzini
parent 6d0a1a61e7
commit 536a6f88c4
2 changed files with 184 additions and 10 deletions

View File

@@ -412,6 +412,8 @@ struct kvm {
#endif
long tlbs_dirty;
struct list_head devices;
struct dentry *debugfs_dentry;
struct kvm_stat_data **debugfs_stat_data;
};
#define kvm_err(fmt, ...) \
@@ -991,6 +993,11 @@ enum kvm_stat_kind {
KVM_STAT_VCPU,
};
struct kvm_stat_data {
int offset;
struct kvm *kvm;
};
struct kvm_stats_debugfs_item {
const char *name;
int offset;