aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/kvm_main.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3c4fe26096fc..32fbf8006969 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1186,38 +1186,38 @@ static struct notifier_block kvm_cpu_notifier = {
1186 .priority = 20, /* must be > scheduler priority */ 1186 .priority = 20, /* must be > scheduler priority */
1187}; 1187};
1188 1188
1189static u64 vm_stat_get(void *_offset) 1189static int vm_stat_get(void *_offset, u64 *val)
1190{ 1190{
1191 unsigned offset = (long)_offset; 1191 unsigned offset = (long)_offset;
1192 u64 total = 0;
1193 struct kvm *kvm; 1192 struct kvm *kvm;
1194 1193
1194 *val = 0;
1195 spin_lock(&kvm_lock); 1195 spin_lock(&kvm_lock);
1196 list_for_each_entry(kvm, &vm_list, vm_list) 1196 list_for_each_entry(kvm, &vm_list, vm_list)
1197 total += *(u32 *)((void *)kvm + offset); 1197 *val += *(u32 *)((void *)kvm + offset);
1198 spin_unlock(&kvm_lock); 1198 spin_unlock(&kvm_lock);
1199 return total; 1199 return 0;
1200} 1200}
1201 1201
1202DEFINE_SIMPLE_ATTRIBUTE(vm_stat_fops, vm_stat_get, NULL, "%llu\n"); 1202DEFINE_SIMPLE_ATTRIBUTE(vm_stat_fops, vm_stat_get, NULL, "%llu\n");
1203 1203
1204static u64 vcpu_stat_get(void *_offset) 1204static int vcpu_stat_get(void *_offset, u64 *val)
1205{ 1205{
1206 unsigned offset = (long)_offset; 1206 unsigned offset = (long)_offset;
1207 u64 total = 0;
1208 struct kvm *kvm; 1207 struct kvm *kvm;
1209 struct kvm_vcpu *vcpu; 1208 struct kvm_vcpu *vcpu;
1210 int i; 1209 int i;
1211 1210
1211 *val = 0;
1212 spin_lock(&kvm_lock); 1212 spin_lock(&kvm_lock);
1213 list_for_each_entry(kvm, &vm_list, vm_list) 1213 list_for_each_entry(kvm, &vm_list, vm_list)
1214 for (i = 0; i < KVM_MAX_VCPUS; ++i) { 1214 for (i = 0; i < KVM_MAX_VCPUS; ++i) {
1215 vcpu = kvm->vcpus[i]; 1215 vcpu = kvm->vcpus[i];
1216 if (vcpu) 1216 if (vcpu)
1217 total += *(u32 *)((void *)vcpu + offset); 1217 *val += *(u32 *)((void *)vcpu + offset);
1218 } 1218 }
1219 spin_unlock(&kvm_lock); 1219 spin_unlock(&kvm_lock);
1220 return total; 1220 return 0;
1221} 1221}
1222 1222
1223DEFINE_SIMPLE_ATTRIBUTE(vcpu_stat_fops, vcpu_stat_get, NULL, "%llu\n"); 1223DEFINE_SIMPLE_ATTRIBUTE(vcpu_stat_fops, vcpu_stat_get, NULL, "%llu\n");