KVM: stats: Support binary stats retrieval for a VM
Add a VM ioctl to get a statistics file descriptor by which a read functionality is provided for userspace to read out VM stats header, descriptors and data. Define VM statistics descriptors and header for all architectures. Reviewed-by: David Matlack <dmatlack@google.com> Reviewed-by: Ricardo Koller <ricarkol@google.com> Reviewed-by: Krish Sadhukhan <krish.sadhukhan@oracle.com> Reviewed-by: Fuad Tabba <tabba@google.com> Tested-by: Fuad Tabba <tabba@google.com> #arm64 Signed-off-by: Jing Zhang <jingzhangos@google.com> Message-Id: <20210618222709.1858088-4-jingzhangos@google.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
cb082bfab5
commit
fcfe1baedd
@@ -599,6 +599,7 @@ struct kvm {
|
||||
#ifdef CONFIG_HAVE_KVM_PM_NOTIFIER
|
||||
struct notifier_block pm_notifier;
|
||||
#endif
|
||||
char stats_id[KVM_STATS_NAME_SIZE];
|
||||
};
|
||||
|
||||
#define kvm_err(fmt, ...) \
|
||||
@@ -1354,12 +1355,17 @@ struct _kvm_stats_desc {
|
||||
STATS_DESC_CUMULATIVE(SCOPE, name, KVM_STATS_UNIT_SECONDS, \
|
||||
KVM_STATS_BASE_POW10, -9)
|
||||
|
||||
#define KVM_GENERIC_VM_STATS() \
|
||||
STATS_DESC_COUNTER(VM_GENERIC, remote_tlb_flush)
|
||||
|
||||
extern struct kvm_stats_debugfs_item debugfs_entries[];
|
||||
extern struct dentry *kvm_debugfs_dir;
|
||||
ssize_t kvm_stats_read(char *id, const struct kvm_stats_header *header,
|
||||
const struct _kvm_stats_desc *desc,
|
||||
void *stats, size_t size_stats,
|
||||
char __user *user_buffer, size_t size, loff_t *offset);
|
||||
extern const struct kvm_stats_header kvm_vm_stats_header;
|
||||
extern const struct _kvm_stats_desc kvm_vm_stats_desc[];
|
||||
|
||||
#if defined(CONFIG_MMU_NOTIFIER) && defined(KVM_ARCH_WANT_MMU_NOTIFIER)
|
||||
static inline int mmu_notifier_retry(struct kvm *kvm, unsigned long mmu_seq)
|
||||
|
||||
Reference in New Issue
Block a user