Thread (24 messages) 24 messages, 4 authors, 2021-06-18

Re: [PATCH v11 3/7] KVM: stats: Support binary stats retrieval for a VM

From: Greg KH <gregkh@linuxfoundation.org>
Date: 2021-06-18 06:58:11
Also in: kvm, kvmarm, linux-kselftest, linux-s390

On Fri, Jun 18, 2021 at 04:48:15AM +0000, Jing Zhang wrote:
quoted hunk ↗ jump to hunk
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 <redacted>
Reviewed-by: Krish Sadhukhan <redacted>
Reviewed-by: Fuad Tabba <tabba@google.com>
Tested-by: Fuad Tabba <tabba@google.com> #arm64
Signed-off-by: Jing Zhang <redacted>
---
 arch/arm64/kvm/guest.c    | 14 +++++++++++++
 arch/mips/kvm/mips.c      | 14 +++++++++++++
 arch/powerpc/kvm/book3s.c | 16 +++++++++++++++
 arch/powerpc/kvm/booke.c  | 16 +++++++++++++++
 arch/s390/kvm/kvm-s390.c  | 19 +++++++++++++++++
 arch/x86/kvm/x86.c        | 24 ++++++++++++++++++++++
 include/linux/kvm_host.h  |  6 ++++++
 virt/kvm/kvm_main.c       | 43 +++++++++++++++++++++++++++++++++++++++
 8 files changed, 152 insertions(+)
diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c
index 4962331d01e6..f456d1defe2b 100644
--- a/arch/arm64/kvm/guest.c
+++ b/arch/arm64/kvm/guest.c
@@ -28,6 +28,20 @@
 
 #include "trace.h"
 
+struct _kvm_stats_desc kvm_vm_stats_desc[] = {
+	KVM_GENERIC_VM_STATS()
+};
+static_assert(ARRAY_SIZE(kvm_vm_stats_desc) ==
+		sizeof(struct kvm_vm_stat) / sizeof(u64));
+
+struct kvm_stats_header kvm_vm_stats_header = {
Can this be const?
+	.name_size = KVM_STATS_NAME_LEN,
+	.count = ARRAY_SIZE(kvm_vm_stats_desc),
+	.desc_offset = sizeof(struct kvm_stats_header) + KVM_STATS_ID_MAXLEN,
+	.data_offset = sizeof(struct kvm_stats_header) + KVM_STATS_ID_MAXLEN +
+		       sizeof(kvm_vm_stats_desc),
+};
If it can't be const, what is modified in it that prevents that from
happening?

thanks,

greg k-h
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help