kvm/stats: Add provisioning for 64-bit vm and vcpu statistics
Subsystems (12)
PATCH v3 4/5 kvm/stats: Add provisioning for 64-bit vm and vcpu statistics
vms and vcpus have statistics associated with them which can be viewed within the debugfs. Currently it is assumed within the vcpu_stat_get() and vm_stat_get() functions that all of these statistics are represented as u32s, however the next patch adds some u64 statistics.
Thus modify these two functions, vcpu_stat_get() and vm_stat_get(), such that they expect u64 statistics and update vm and vcpu statistics to u64s accordingly.
---
Change Log:
V1 -> V2:
- Nothing
V2 -> V3:
- Instead of implementing separate u32 and u64 functions keep the generic functions and modify them to expect u64s. Thus update all vm and vcpu statistics to u64s accordingly.
--- arch/arm/include/asm/kvm_host.h | 12 ++-- arch/arm64/include/asm/kvm_host.h | 12 ++-- arch/mips/include/asm/kvm_host.h | 46 ++++++------- arch/powerpc/include/asm/kvm_host.h | 60 ++++++++--------- arch/s390/include/asm/kvm_host.h | 128 ++++++++++++++++++------------------ arch/x86/include/asm/kvm_host.h | 72 ++++++++++---------- virt/kvm/kvm_main.c | 12 ++-- 7 files changed, 171 insertions(+), 171 deletions(-)
arch/arm/include/asm/kvm_host.h +6 -6
@@ -183,15 +183,15 @@ struct kvm_vcpu_arch { };struct kvm_vm_stat { -u32 remote_tlb_flush; +u64 remote_tlb_flush; };struct kvm_vcpu_stat { -u32 halt_successful_poll; -u32 halt_attempted_poll; -u32 halt_poll_invalid; -u32 halt_wakeup; -u32 hvc_exit_stat; +u64 halt_successful_poll; +u64 halt_attempted_poll; +u64 halt_poll_invalid; +u64 halt_wakeup; +u64 hvc_exit_stat;u64 wfe_exit_stat;u64 wfi_exit_stat;u64 mmio_exit_user;
arch/arm64/include/asm/kvm_host.h +6 -6
@@ -291,15 +291,15 @@ struct kvm_vcpu_arch {#endif struct kvm_vm_stat { -u32 remote_tlb_flush; +u64 remote_tlb_flush; };struct kvm_vcpu_stat { -u32 halt_successful_poll; -u32 halt_attempted_poll; -u32 halt_poll_invalid; -u32 halt_wakeup; -u32 hvc_exit_stat; +u64 halt_successful_poll; +u64 halt_attempted_poll; +u64 halt_poll_invalid; +u64 halt_wakeup; +u64 hvc_exit_stat;u64 wfe_exit_stat;u64 wfi_exit_stat;u64 mmio_exit_user;
arch/mips/include/asm/kvm_host.h +23 -23
55 lines not on this page · raw message
arch/powerpc/include/asm/kvm_host.h +30 -30
71 lines not on this page · raw message
arch/s390/include/asm/kvm_host.h +64 -64
140 lines not on this page · raw message
arch/x86/include/asm/kvm_host.h +36 -36
81 lines not on this page · raw message
virt/kvm/kvm_main.c +6 -6
@@ -3531,7 +3531,7 @@ static int vm_stat_get_per_vm(void *data, u64 *val) {struct kvm_stat_data *stat_data = (struct kvm_stat_data *)data; - *val = *(u32 *)((void *)stat_data->kvm + stat_data->offset); + *val = *(u64 *)((void *)stat_data->kvm + stat_data->offset);return 0 ; }
@@ -3561,7 +3561,7 @@ static int vcpu_stat_get_per_vm(void *data, u64 *val) *val =0 ;kvm_for_each_vcpu (i, vcpu, stat_data->kvm) - *val += *(u32 *)((void *)vcpu + stat_data->offset); + *val += *(u64 *)((void *)vcpu + stat_data->offset);return 0 ; }
@@ -3583,8 +3583,8 @@ static const struct file_operations vcpu_stat_get_per_vm_fops = { };static const struct file_operations *stat_fops_per_vm[] = { - [KVM_STAT_VCPU ] = &vcpu_stat_get_per_vm_fops, - [KVM_STAT_VM ] = &vm_stat_get_per_vm_fops, + [KVM_STAT_VCPU ] = &vcpu_stat_get_per_vm_fops, + [KVM_STAT_VM ] = &vm_stat_get_per_vm_fops, };static int vm_stat_get (void *_offset,u64 *val)
@@ -3628,8 +3628,8 @@ static int vcpu_stat_get(void *_offset, u64 *val)DEFINE_SIMPLE_ATTRIBUTE (vcpu_stat_fops, vcpu_stat_get,NULL ,"%llu\n" );static const struct file_operations *stat_fops[] = { - [KVM_STAT_VCPU ] = &vcpu_stat_fops, - [KVM_STAT_VM ] = &vm_stat_fops, + [KVM_STAT_VCPU ] = &vcpu_stat_fops, + [KVM_STAT_VM ] = &vm_stat_fops, };static int kvm_init_debug (void )
Signature · 1 line
2.5.5
Quoted 12 lines · Suraj Jitindar Singh
vms and vcpus have statistics associated with them which can be viewed within the debugfs. Currently it is assumed within the
vcpu_stat_get()andvm_stat_get()functions that all of these statistics are represented as u32s, however the next patch adds some u64 statistics.Thus modify these two functions,
vcpu_stat_get()andvm_stat_get(), such that they expect u64 statistics and update vm and vcpu statistics to u64s accordingly.---
Change Log:
Quoted 6 lines
V1 -> V2:
- Nothing
V2 -> V3:
- Instead of implementing separate u32 and u64 functions keep the generic functions and modify them to expect u64s. Thus update all vm and vcpu statistics to u64s accordingly.
Have not looked into everything, but I agree with changing everything to 64bit.
virt/kvm/kvm_main.c static const struct file_operations vcpu_stat_get_per_vm_fops = { · line 3588
Quoted 9 lines
virt/kvm/kvm_main.c +2
-2@@ -3583,8 +3583,8 @@ static const struct file_operations vcpu_stat_get_per_vm_fops = { };static const struct file_operations *stat_fops_per_vm[] = { - [KVM_STAT_VCPU ] = &vcpu_stat_get_per_vm_fops, - [KVM_STAT_VM ] = &vm_stat_get_per_vm_fops, + [KVM_STAT_VCPU ] = &vcpu_stat_get_per_vm_fops, + [KVM_STAT_VM ] = &vm_stat_get_per_vm_fops, };
unrelated white space changes?
Quoted 14 lines
virt/kvm/kvm_main.c +2
-2static int vm_stat_get (void *_offset,u64 *val)@@ -3628,8 +3628,8 @@ static int vcpu_stat_get(void *_offset, u64 *val)DEFINE_SIMPLE_ATTRIBUTE (vcpu_stat_fops, vcpu_stat_get,NULL ,"%llu\n" );static const struct file_operations *stat_fops[] = { - [KVM_STAT_VCPU ] = &vcpu_stat_fops, - [KVM_STAT_VM ] = &vm_stat_fops, + [KVM_STAT_VCPU ] = &vcpu_stat_fops, + [KVM_STAT_VM ] = &vm_stat_fops, };static int kvm_init_debug (void )
Quoted 25 lines · Christian Borntraeger
Quoted 12 lines · Suraj Jitindar Singh
vms and vcpus have statistics associated with them which can be viewed within the debugfs. Currently it is assumed within the
vcpu_stat_get()andvm_stat_get()functions that all of these statistics are represented as u32s, however the next patch adds some u64 statistics.Thus modify these two functions,
vcpu_stat_get()andvm_stat_get(), such that they expect u64 statistics and update vm and vcpu statistics to u64s accordingly.---
Change Log:Quoted 6 lines
V1 -> V2:
- Nothing
V2 -> V3:
- Instead of implementing separate u32 and u64 functions keep the generic functions and modify them to expect u64s. Thus update all vm and vcpu statistics to u64s accordingly.Have not looked into everything, but I agree with changing everything to 64bit.
Quoted 3 lines
(quoted diff) +0
-0@@ -3583,8 +3583,8 @@ static const struct file_operations vcpu_stat_get_per_vm_fops = { };
Quoted 7 lines
virt/kvm/kvm_main.c static const struct file_operations vcpu_stat_get_per_vm_fops = { · line 3588
Quoted 6 lines
virt/kvm/kvm_main.c +2
-2static const struct file_operations *stat_fops_per_vm[] = { - [KVM_STAT_VCPU ] = &vcpu_stat_get_per_vm_fops, - [KVM_STAT_VM ] = &vm_stat_get_per_vm_fops, + [KVM_STAT_VCPU ] = &vcpu_stat_get_per_vm_fops, + [KVM_STAT_VM ] = &vm_stat_get_per_vm_fops, };unrelated white space changes?
Woops, I'll fix that. Thanks
Quoted 14 lines
Quoted 14 lines
virt/kvm/kvm_main.c +2
-2static int vm_stat_get (void *_offset,u64 *val)@@ -3628,8 +3628,8 @@ static int vcpu_stat_get(void *_offset, u64 *val)DEFINE_SIMPLE_ATTRIBUTE (vcpu_stat_fops, vcpu_stat_get,NULL ,"%llu\n" );static const struct file_operations *stat_fops[] = { - [KVM_STAT_VCPU ] = &vcpu_stat_fops, - [KVM_STAT_VM ] = &vm_stat_fops, + [KVM_STAT_VCPU ] = &vcpu_stat_fops, + [KVM_STAT_VM ] = &vm_stat_fops, };static int kvm_init_debug (void )