KVM generic changes for 7.0 - Remove a subtle pseudo-overlay of kvm_stats_desc, which, aside from being unnecessary and confusing, triggered compiler warnings due to -Wflex-array-member-not-at-end. - Document that vcpu->mutex is take outside of kvm->slots_lock and kvm->slots_arch_lock, which is intentional and desirable despite being rather unintuitive.
Unified · Split
| @@ -17,6 +17,8 @@ The acquisition orders for mutexes are as follows: · 16 unmodified lines | |||
| 17 | 17 | ||
| 18 | - kvm->lock is taken outside kvm->slots_lock and kvm->irq_lock | 18 | - kvm->lock is taken outside kvm->slots_lock and kvm->irq_lock |
| 19 | 19 | ||
| 20 | - vcpu->mutex is taken outside kvm->slots_lock and kvm->slots_arch_lock | ||
| 21 | |||
| 20 | - kvm->slots_lock is taken outside kvm->irq_lock, though acquiring | 22 | - kvm->slots_lock is taken outside kvm->irq_lock, though acquiring |
| 21 | them together is quite rare. | 23 | them together is quite rare. |
| 22 | 24 | ||
| @@ -29,7 +29,7 @@ · 28 unmodified lines | |||
| 29 | 29 | ||
| 30 | #include "trace.h" | 30 | #include "trace.h" |
| 31 | 31 | ||
| 32 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 32 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 33 | KVM_GENERIC_VM_STATS() | 33 | KVM_GENERIC_VM_STATS() |
| 34 | }; | 34 | }; |
| 35 | 35 | ||
| @@ -42,7 +42,7 @@ const struct kvm_stats_header kvm_vm_stats_header = { · 6 unmodified lines | |||
| 42 | sizeof(kvm_vm_stats_desc), | 42 | sizeof(kvm_vm_stats_desc), |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| 45 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 45 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 46 | KVM_GENERIC_VCPU_STATS(), | 46 | KVM_GENERIC_VCPU_STATS(), |
| 47 | STATS_DESC_COUNTER(VCPU, hvc_exit_stat), | 47 | STATS_DESC_COUNTER(VCPU, hvc_exit_stat), |
| 48 | STATS_DESC_COUNTER(VCPU, wfe_exit_stat), | 48 | STATS_DESC_COUNTER(VCPU, wfe_exit_stat), |
| @@ -14,7 +14,7 @@ · 13 unmodified lines | |||
| 14 | #define CREATE_TRACE_POINTS | 14 | #define CREATE_TRACE_POINTS |
| 15 | #include "trace.h" | 15 | #include "trace.h" |
| 16 | 16 | ||
| 17 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 17 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 18 | KVM_GENERIC_VCPU_STATS(), | 18 | KVM_GENERIC_VCPU_STATS(), |
| 19 | STATS_DESC_COUNTER(VCPU, int_exits), | 19 | STATS_DESC_COUNTER(VCPU, int_exits), |
| 20 | STATS_DESC_COUNTER(VCPU, idle_exits), | 20 | STATS_DESC_COUNTER(VCPU, idle_exits), |
| @@ -10,7 +10,7 @@ · 9 unmodified lines | |||
| 10 | #include <asm/kvm_eiointc.h> | 10 | #include <asm/kvm_eiointc.h> |
| 11 | #include <asm/kvm_pch_pic.h> | 11 | #include <asm/kvm_pch_pic.h> |
| 12 | 12 | ||
| 13 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 13 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 14 | KVM_GENERIC_VM_STATS(), | 14 | KVM_GENERIC_VM_STATS(), |
| 15 | STATS_DESC_ICOUNTER(VM, pages), | 15 | STATS_DESC_ICOUNTER(VM, pages), |
| 16 | STATS_DESC_ICOUNTER(VM, hugepages), | 16 | STATS_DESC_ICOUNTER(VM, hugepages), |
| @@ -38,7 +38,7 @@ · 37 unmodified lines | |||
| 38 | #define VECTORSPACING 0x100 /* for EI/VI mode */ | 38 | #define VECTORSPACING 0x100 /* for EI/VI mode */ |
| 39 | #endif | 39 | #endif |
| 40 | 40 | ||
| 41 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 41 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 42 | KVM_GENERIC_VM_STATS() | 42 | KVM_GENERIC_VM_STATS() |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| @@ -51,7 +51,7 @@ const struct kvm_stats_header kvm_vm_stats_header = { · 6 unmodified lines | |||
| 51 | sizeof(kvm_vm_stats_desc), | 51 | sizeof(kvm_vm_stats_desc), |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 54 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 55 | KVM_GENERIC_VCPU_STATS(), | 55 | KVM_GENERIC_VCPU_STATS(), |
| 56 | STATS_DESC_COUNTER(VCPU, wait_exits), | 56 | STATS_DESC_COUNTER(VCPU, wait_exits), |
| 57 | STATS_DESC_COUNTER(VCPU, cache_exits), | 57 | STATS_DESC_COUNTER(VCPU, cache_exits), |
| @@ -38,7 +38,7 @@ · 37 unmodified lines | |||
| 38 | 38 | ||
| 39 | /* #define EXIT_DEBUG */ | 39 | /* #define EXIT_DEBUG */ |
| 40 | 40 | ||
| 41 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 41 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 42 | KVM_GENERIC_VM_STATS(), | 42 | KVM_GENERIC_VM_STATS(), |
| 43 | STATS_DESC_ICOUNTER(VM, num_2M_pages), | 43 | STATS_DESC_ICOUNTER(VM, num_2M_pages), |
| 44 | STATS_DESC_ICOUNTER(VM, num_1G_pages) | 44 | STATS_DESC_ICOUNTER(VM, num_1G_pages) |
| @@ -53,7 +53,7 @@ const struct kvm_stats_header kvm_vm_stats_header = { · 8 unmodified lines | |||
| 53 | sizeof(kvm_vm_stats_desc), | 53 | sizeof(kvm_vm_stats_desc), |
| 54 | }; | 54 | }; |
| 55 | 55 | ||
| 56 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 56 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 57 | KVM_GENERIC_VCPU_STATS(), | 57 | KVM_GENERIC_VCPU_STATS(), |
| 58 | STATS_DESC_COUNTER(VCPU, sum_exits), | 58 | STATS_DESC_COUNTER(VCPU, sum_exits), |
| 59 | STATS_DESC_COUNTER(VCPU, mmio_exits), | 59 | STATS_DESC_COUNTER(VCPU, mmio_exits), |
| @@ -36,7 +36,7 @@ · 35 unmodified lines | |||
| 36 | 36 | ||
| 37 | unsigned long kvmppc_booke_handlers; | 37 | unsigned long kvmppc_booke_handlers; |
| 38 | 38 | ||
| 39 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 39 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 40 | KVM_GENERIC_VM_STATS(), | 40 | KVM_GENERIC_VM_STATS(), |
| 41 | STATS_DESC_ICOUNTER(VM, num_2M_pages), | 41 | STATS_DESC_ICOUNTER(VM, num_2M_pages), |
| 42 | STATS_DESC_ICOUNTER(VM, num_1G_pages) | 42 | STATS_DESC_ICOUNTER(VM, num_1G_pages) |
| @@ -51,7 +51,7 @@ const struct kvm_stats_header kvm_vm_stats_header = { · 8 unmodified lines | |||
| 51 | sizeof(kvm_vm_stats_desc), | 51 | sizeof(kvm_vm_stats_desc), |
| 52 | }; | 52 | }; |
| 53 | 53 | ||
| 54 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 54 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 55 | KVM_GENERIC_VCPU_STATS(), | 55 | KVM_GENERIC_VCPU_STATS(), |
| 56 | STATS_DESC_COUNTER(VCPU, sum_exits), | 56 | STATS_DESC_COUNTER(VCPU, sum_exits), |
| 57 | STATS_DESC_COUNTER(VCPU, mmio_exits), | 57 | STATS_DESC_COUNTER(VCPU, mmio_exits), |
| @@ -24,7 +24,7 @@ · 23 unmodified lines | |||
| 24 | #define CREATE_TRACE_POINTS | 24 | #define CREATE_TRACE_POINTS |
| 25 | #include "trace.h" | 25 | #include "trace.h" |
| 26 | 26 | ||
| 27 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 27 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 28 | KVM_GENERIC_VCPU_STATS(), | 28 | KVM_GENERIC_VCPU_STATS(), |
| 29 | STATS_DESC_COUNTER(VCPU, ecall_exit_stat), | 29 | STATS_DESC_COUNTER(VCPU, ecall_exit_stat), |
| 30 | STATS_DESC_COUNTER(VCPU, wfi_exit_stat), | 30 | STATS_DESC_COUNTER(VCPU, wfi_exit_stat), |
| @@ -13,7 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include <linux/kvm_host.h> | 13 | #include <linux/kvm_host.h> |
| 14 | #include <asm/kvm_mmu.h> | 14 | #include <asm/kvm_mmu.h> |
| 15 | 15 | ||
| 16 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 16 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 17 | KVM_GENERIC_VM_STATS() | 17 | KVM_GENERIC_VM_STATS() |
| 18 | }; | 18 | }; |
| 19 | static_assert(ARRAY_SIZE(kvm_vm_stats_desc) == | 19 | static_assert(ARRAY_SIZE(kvm_vm_stats_desc) == |
| @@ -65,7 +65,7 @@ · 64 unmodified lines | |||
| 65 | #define VCPU_IRQS_MAX_BUF (sizeof(struct kvm_s390_irq) * \ | 65 | #define VCPU_IRQS_MAX_BUF (sizeof(struct kvm_s390_irq) * \ |
| 66 | (KVM_MAX_VCPUS + LOCAL_IRQS)) | 66 | (KVM_MAX_VCPUS + LOCAL_IRQS)) |
| 67 | 67 | ||
| 68 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 68 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 69 | KVM_GENERIC_VM_STATS(), | 69 | KVM_GENERIC_VM_STATS(), |
| 70 | STATS_DESC_COUNTER(VM, inject_io), | 70 | STATS_DESC_COUNTER(VM, inject_io), |
| 71 | STATS_DESC_COUNTER(VM, inject_float_mchk), | 71 | STATS_DESC_COUNTER(VM, inject_float_mchk), |
| @@ -91,7 +91,7 @@ const struct kvm_stats_header kvm_vm_stats_header = { · 19 unmodified lines | |||
| 91 | sizeof(kvm_vm_stats_desc), | 91 | sizeof(kvm_vm_stats_desc), |
| 92 | }; | 92 | }; |
| 93 | 93 | ||
| 94 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 94 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 95 | KVM_GENERIC_VCPU_STATS(), | 95 | KVM_GENERIC_VCPU_STATS(), |
| 96 | STATS_DESC_COUNTER(VCPU, exit_userspace), | 96 | STATS_DESC_COUNTER(VCPU, exit_userspace), |
| 97 | STATS_DESC_COUNTER(VCPU, exit_null), | 97 | STATS_DESC_COUNTER(VCPU, exit_null), |
| @@ -243,7 +243,7 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(enable_ipiv); · 242 unmodified lines | |||
| 243 | bool __read_mostly enable_device_posted_irqs = true; | 243 | bool __read_mostly enable_device_posted_irqs = true; |
| 244 | EXPORT_SYMBOL_FOR_KVM_INTERNAL(enable_device_posted_irqs); | 244 | EXPORT_SYMBOL_FOR_KVM_INTERNAL(enable_device_posted_irqs); |
| 245 | 245 | ||
| 246 | const struct _kvm_stats_desc kvm_vm_stats_desc[] = { | 246 | const struct kvm_stats_desc kvm_vm_stats_desc[] = { |
| 247 | KVM_GENERIC_VM_STATS(), | 247 | KVM_GENERIC_VM_STATS(), |
| 248 | STATS_DESC_COUNTER(VM, mmu_shadow_zapped), | 248 | STATS_DESC_COUNTER(VM, mmu_shadow_zapped), |
| 249 | STATS_DESC_COUNTER(VM, mmu_pte_write), | 249 | STATS_DESC_COUNTER(VM, mmu_pte_write), |
| @@ -269,7 +269,7 @@ const struct kvm_stats_header kvm_vm_stats_header = { · 19 unmodified lines | |||
| 269 | sizeof(kvm_vm_stats_desc), | 269 | sizeof(kvm_vm_stats_desc), |
| 270 | }; | 270 | }; |
| 271 | 271 | ||
| 272 | const struct _kvm_stats_desc kvm_vcpu_stats_desc[] = { | 272 | const struct kvm_stats_desc kvm_vcpu_stats_desc[] = { |
| 273 | KVM_GENERIC_VCPU_STATS(), | 273 | KVM_GENERIC_VCPU_STATS(), |
| 274 | STATS_DESC_COUNTER(VCPU, pf_taken), | 274 | STATS_DESC_COUNTER(VCPU, pf_taken), |
| 275 | STATS_DESC_COUNTER(VCPU, pf_fixed), | 275 | STATS_DESC_COUNTER(VCPU, pf_fixed), |
| @@ -1940,56 +1940,43 @@ enum kvm_stat_kind { · 1939 unmodified lines | |||
| 1940 | 1940 | ||
| 1941 | struct kvm_stat_data { | 1941 | struct kvm_stat_data { |
| 1942 | struct kvm *kvm; | 1942 | struct kvm *kvm; |
| 1943 | const struct _kvm_stats_desc *desc; | 1943 | const struct kvm_stats_desc *desc; |
| 1944 | enum kvm_stat_kind kind; | 1944 | enum kvm_stat_kind kind; |
| 1945 | }; | 1945 | }; |
| 1946 | 1946 | ||
| 1947 | struct _kvm_stats_desc { | 1947 | #define STATS_DESC_COMMON(type, unit, base, exp, sz, bsz) \ |
| 1948 | struct kvm_stats_desc desc; | 1948 | .flags = type | unit | base | \ |
| 1949 | char name[KVM_STATS_NAME_SIZE]; | 1949 | BUILD_BUG_ON_ZERO(type & ~KVM_STATS_TYPE_MASK) | \ |
| 1950 | }; | 1950 | BUILD_BUG_ON_ZERO(unit & ~KVM_STATS_UNIT_MASK) | \ |
| 1951 | 1951 | BUILD_BUG_ON_ZERO(base & ~KVM_STATS_BASE_MASK), \ | |
| 1952 | #define STATS_DESC_COMMON(type, unit, base, exp, sz, bsz) \ | 1952 | .exponent = exp, \ |
| 1953 | .flags = type | unit | base | \ | 1953 | .size = sz, \ |
| 1954 | BUILD_BUG_ON_ZERO(type & ~KVM_STATS_TYPE_MASK) | \ | ||
| 1955 | BUILD_BUG_ON_ZERO(unit & ~KVM_STATS_UNIT_MASK) | \ | ||
| 1956 | BUILD_BUG_ON_ZERO(base & ~KVM_STATS_BASE_MASK), \ | ||
| 1957 | .exponent = exp, \ | ||
| 1958 | .size = sz, \ | ||
| 1959 | .bucket_size = bsz | 1954 | .bucket_size = bsz |
| 1960 | 1955 | ||
| 1961 | #define VM_GENERIC_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ | 1956 | #define VM_GENERIC_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ |
| 1962 | { \ | 1957 | { \ |
| 1963 | { \ | 1958 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ |
| 1964 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ | 1959 | .offset = offsetof(struct kvm_vm_stat, generic.stat), \ |
| 1965 | .offset = offsetof(struct kvm_vm_stat, generic.stat) \ | 1960 | .name = #stat, \ |
| 1966 | }, \ | 1961 | } |
| 1967 | .name = #stat, \ | 1962 | #define VCPU_GENERIC_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ |
| 1968 | } | 1963 | { \ |
| 1969 | #define VCPU_GENERIC_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ | 1964 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ |
| 1970 | { \ | 1965 | .offset = offsetof(struct kvm_vcpu_stat, generic.stat), \ |
| 1971 | { \ | 1966 | .name = #stat, \ |
| 1972 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ | 1967 | } |
| 1973 | .offset = offsetof(struct kvm_vcpu_stat, generic.stat) \ | 1968 | #define VM_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ |
| 1974 | }, \ | 1969 | { \ |
| 1975 | .name = #stat, \ | 1970 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ |
| 1976 | } | 1971 | .offset = offsetof(struct kvm_vm_stat, stat), \ |
| 1977 | #define VM_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ | 1972 | .name = #stat, \ |
| 1978 | { \ | 1973 | } |
| 1979 | { \ | 1974 | #define VCPU_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ |
| 1980 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ | 1975 | { \ |
| 1981 | .offset = offsetof(struct kvm_vm_stat, stat) \ | 1976 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ |
| 1982 | }, \ | 1977 | .offset = offsetof(struct kvm_vcpu_stat, stat), \ |
| 1983 | .name = #stat, \ | 1978 | .name = #stat, \ |
| 1984 | } | 1979 | } |
| 1985 | #define VCPU_STATS_DESC(stat, type, unit, base, exp, sz, bsz) \ | ||
| 1986 | { \ | ||
| 1987 | { \ | ||
| 1988 | STATS_DESC_COMMON(type, unit, base, exp, sz, bsz), \ | ||
| 1989 | .offset = offsetof(struct kvm_vcpu_stat, stat) \ | ||
| 1990 | }, \ | ||
| 1991 | .name = #stat, \ | ||
| 1992 | } | ||
| 1993 | /* SCOPE: VM, VM_GENERIC, VCPU, VCPU_GENERIC */ | 1980 | /* SCOPE: VM, VM_GENERIC, VCPU, VCPU_GENERIC */ |
| 1994 | #define STATS_DESC(SCOPE, stat, type, unit, base, exp, sz, bsz) \ | 1981 | #define STATS_DESC(SCOPE, stat, type, unit, base, exp, sz, bsz) \ |
| 1995 | SCOPE##_STATS_DESC(stat, type, unit, base, exp, sz, bsz) | 1982 | SCOPE##_STATS_DESC(stat, type, unit, base, exp, sz, bsz) |
| @@ -2066,7 +2053,7 @@ struct _kvm_stats_desc { · 70 unmodified lines | |||
| 2066 | STATS_DESC_IBOOLEAN(VCPU_GENERIC, blocking) | 2053 | STATS_DESC_IBOOLEAN(VCPU_GENERIC, blocking) |
| 2067 | 2054 | ||
| 2068 | ssize_t kvm_stats_read(char *id, const struct kvm_stats_header *header, | 2055 | ssize_t kvm_stats_read(char *id, const struct kvm_stats_header *header, |
| 2069 | const struct _kvm_stats_desc *desc, | 2056 | const struct kvm_stats_desc *desc, |
| 2070 | void *stats, size_t size_stats, | 2057 | void *stats, size_t size_stats, |
| 2071 | char __user *user_buffer, size_t size, loff_t *offset); | 2058 | char __user *user_buffer, size_t size, loff_t *offset); |
| 2072 | 2059 | ||
| @@ -2111,9 +2098,9 @@ static inline void kvm_stats_log_hist_update(u64 *data, size_t size, u64 value) · 38 unmodified lines | |||
| 2111 | 2098 | ||
| 2112 | 2099 | ||
| 2113 | extern const struct kvm_stats_header kvm_vm_stats_header; | 2100 | extern const struct kvm_stats_header kvm_vm_stats_header; |
| 2114 | extern const struct _kvm_stats_desc kvm_vm_stats_desc[]; | 2101 | extern const struct kvm_stats_desc kvm_vm_stats_desc[]; |
| 2115 | extern const struct kvm_stats_header kvm_vcpu_stats_header; | 2102 | extern const struct kvm_stats_header kvm_vcpu_stats_header; |
| 2116 | extern const struct _kvm_stats_desc kvm_vcpu_stats_desc[]; | 2103 | extern const struct kvm_stats_desc kvm_vcpu_stats_desc[]; |
| 2117 | 2104 | ||
| 2118 | static inline int mmu_invalidate_retry(struct kvm *kvm, unsigned long mmu_seq) | 2105 | static inline int mmu_invalidate_retry(struct kvm *kvm, unsigned long mmu_seq) |
| 2119 | { | 2106 | { |
| @@ -14,6 +14,10 @@ · 13 unmodified lines | |||
| 14 | #include <linux/ioctl.h> | 14 | #include <linux/ioctl.h> |
| 15 | #include <asm/kvm.h> | 15 | #include <asm/kvm.h> |
| 16 | 16 | ||
| 17 | #ifdef __KERNEL__ | ||
| 18 | #include <linux/kvm_types.h> | ||
| 19 | #endif | ||
| 20 | |||
| 17 | #define KVM_API_VERSION 12 | 21 | #define KVM_API_VERSION 12 |
| 18 | 22 | ||
| 19 | /* | 23 | /* |
| @@ -1601,7 +1605,11 @@ struct kvm_stats_desc { · 1581 unmodified lines | |||
| 1601 | __u16 size; | 1605 | __u16 size; |
| 1602 | __u32 offset; | 1606 | __u32 offset; |
| 1603 | __u32 bucket_size; | 1607 | __u32 bucket_size; |
| 1608 | #ifdef __KERNEL__ | ||
| 1609 | char name[KVM_STATS_NAME_SIZE]; | ||
| 1610 | #else | ||
| 1604 | char name[]; | 1611 | char name[]; |
| 1612 | #endif | ||
| 1605 | }; | 1613 | }; |
| 1606 | 1614 | ||
| 1607 | #define KVM_GET_STATS_FD _IO(KVMIO, 0xce) | 1615 | #define KVM_GET_STATS_FD _IO(KVMIO, 0xce) |
| @@ -50,7 +50,7 @@ · 49 unmodified lines | |||
| 50 | * Return: the number of bytes that has been successfully read | 50 | * Return: the number of bytes that has been successfully read |
| 51 | */ | 51 | */ |
| 52 | ssize_t kvm_stats_read(char *id, const struct kvm_stats_header *header, | 52 | ssize_t kvm_stats_read(char *id, const struct kvm_stats_header *header, |
| 53 | const struct _kvm_stats_desc *desc, | 53 | const struct kvm_stats_desc *desc, |
| 54 | void *stats, size_t size_stats, | 54 | void *stats, size_t size_stats, |
| 55 | char __user *user_buffer, size_t size, loff_t *offset) | 55 | char __user *user_buffer, size_t size, loff_t *offset) |
| 56 | { | 56 | { |
| @@ -973,9 +973,9 @@ static void kvm_free_memslots(struct kvm *kvm, struct kvm_memslots *slots) · 972 unmodified lines | |||
| 973 | kvm_free_memslot(kvm, memslot); | 973 | kvm_free_memslot(kvm, memslot); |
| 974 | } | 974 | } |
| 975 | 975 | ||
| 976 | static umode_t kvm_stats_debugfs_mode(const struct _kvm_stats_desc *pdesc) | 976 | static umode_t kvm_stats_debugfs_mode(const struct kvm_stats_desc *desc) |
| 977 | { | 977 | { |
| 978 | switch (pdesc->desc.flags & KVM_STATS_TYPE_MASK) { | 978 | switch (desc->flags & KVM_STATS_TYPE_MASK) { |
| 979 | case KVM_STATS_TYPE_INSTANT: | 979 | case KVM_STATS_TYPE_INSTANT: |
| 980 | return 0444; | 980 | return 0444; |
| 981 | case KVM_STATS_TYPE_CUMULATIVE: | 981 | case KVM_STATS_TYPE_CUMULATIVE: |
| @@ -1010,7 +1010,7 @@ static int kvm_create_vm_debugfs(struct kvm *kvm, const char *fdname) · 28 unmodified lines | |||
| 1010 | struct dentry *dent; | 1010 | struct dentry *dent; |
| 1011 | char dir_name[ITOA_MAX_LEN * 2]; | 1011 | char dir_name[ITOA_MAX_LEN * 2]; |
| 1012 | struct kvm_stat_data *stat_data; | 1012 | struct kvm_stat_data *stat_data; |
| 1013 | const struct _kvm_stats_desc *pdesc; | 1013 | const struct kvm_stats_desc *pdesc; |
| 1014 | int i, ret = -ENOMEM; | 1014 | int i, ret = -ENOMEM; |
| 1015 | int kvm_debugfs_num_entries = kvm_vm_stats_header.num_desc + | 1015 | int kvm_debugfs_num_entries = kvm_vm_stats_header.num_desc + |
| 1016 | kvm_vcpu_stats_header.num_desc; | 1016 | kvm_vcpu_stats_header.num_desc; |
| @@ -6171,11 +6171,11 @@ static int kvm_stat_data_get(void *data, u64 *val) · 5154 unmodified lines | |||
| 6171 | switch (stat_data->kind) { | 6171 | switch (stat_data->kind) { |
| 6172 | case KVM_STAT_VM: | 6172 | case KVM_STAT_VM: |
| 6173 | r = kvm_get_stat_per_vm(stat_data->kvm, | 6173 | r = kvm_get_stat_per_vm(stat_data->kvm, |
| 6174 | stat_data->desc->desc.offset, val); | 6174 | stat_data->desc->offset, val); |
| 6175 | break; | 6175 | break; |
| 6176 | case KVM_STAT_VCPU: | 6176 | case KVM_STAT_VCPU: |
| 6177 | r = kvm_get_stat_per_vcpu(stat_data->kvm, | 6177 | r = kvm_get_stat_per_vcpu(stat_data->kvm, |
| 6178 | stat_data->desc->desc.offset, val); | 6178 | stat_data->desc->offset, val); |
| 6179 | break; | 6179 | break; |
| 6180 | } | 6180 | } |
| 6181 | 6181 | ||
| @@ -6193,11 +6193,11 @@ static int kvm_stat_data_clear(void *data, u64 val) · 11 unmodified lines | |||
| 6193 | switch (stat_data->kind) { | 6193 | switch (stat_data->kind) { |
| 6194 | case KVM_STAT_VM: | 6194 | case KVM_STAT_VM: |
| 6195 | r = kvm_clear_stat_per_vm(stat_data->kvm, | 6195 | r = kvm_clear_stat_per_vm(stat_data->kvm, |
| 6196 | stat_data->desc->desc.offset); | 6196 | stat_data->desc->offset); |
| 6197 | break; | 6197 | break; |
| 6198 | case KVM_STAT_VCPU: | 6198 | case KVM_STAT_VCPU: |
| 6199 | r = kvm_clear_stat_per_vcpu(stat_data->kvm, | 6199 | r = kvm_clear_stat_per_vcpu(stat_data->kvm, |
| 6200 | stat_data->desc->desc.offset); | 6200 | stat_data->desc->offset); |
| 6201 | break; | 6201 | break; |
| 6202 | } | 6202 | } |
| 6203 | 6203 | ||
| @@ -6345,7 +6345,7 @@ static void kvm_uevent_notify_change(unsigned int type, struct kvm *kvm) · 141 unmodified lines | |||
| 6345 | static void kvm_init_debug(void) | 6345 | static void kvm_init_debug(void) |
| 6346 | { | 6346 | { |
| 6347 | const struct file_operations *fops; | 6347 | const struct file_operations *fops; |
| 6348 | const struct _kvm_stats_desc *pdesc; | 6348 | const struct kvm_stats_desc *pdesc; |
| 6349 | int i; | 6349 | int i; |
| 6350 | 6350 | ||
| 6351 | kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); | 6351 | kvm_debugfs_dir = debugfs_create_dir("kvm", NULL); |
| @@ -6358,7 +6358,7 @@ static void kvm_init_debug(void) · 6 unmodified lines | |||
| 6358 | fops = &vm_stat_readonly_fops; | 6358 | fops = &vm_stat_readonly_fops; |
| 6359 | debugfs_create_file(pdesc->name, kvm_stats_debugfs_mode(pdesc), | 6359 | debugfs_create_file(pdesc->name, kvm_stats_debugfs_mode(pdesc), |
| 6360 | kvm_debugfs_dir, | 6360 | kvm_debugfs_dir, |
| 6361 | (void *)(long)pdesc->desc.offset, fops); | 6361 | (void *)(long)pdesc->offset, fops); |
| 6362 | } | 6362 | } |
| 6363 | 6363 | ||
| 6364 | for (i = 0; i < kvm_vcpu_stats_header.num_desc; ++i) { | 6364 | for (i = 0; i < kvm_vcpu_stats_header.num_desc; ++i) { |
| @@ -6369,7 +6369,7 @@ static void kvm_init_debug(void) · 4 unmodified lines | |||
| 6369 | fops = &vcpu_stat_readonly_fops; | 6369 | fops = &vcpu_stat_readonly_fops; |
| 6370 | debugfs_create_file(pdesc->name, kvm_stats_debugfs_mode(pdesc), | 6370 | debugfs_create_file(pdesc->name, kvm_stats_debugfs_mode(pdesc), |
| 6371 | kvm_debugfs_dir, | 6371 | kvm_debugfs_dir, |
| 6372 | (void *)(long)pdesc->desc.offset, fops); | 6372 | (void *)(long)pdesc->offset, fops); |
| 6373 | } | 6373 | } |
| 6374 | } | 6374 | } |
| 6375 | 6375 | ||