From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Date: Fri, 18 Jun 2021 06:58:04 +0000 Subject: Re: [PATCH v11 3/7] KVM: stats: Support binary stats retrieval for a VM Message-Id: List-Id: References: <20210618044819.3690166-1-jingzhangos@google.com> <20210618044819.3690166-4-jingzhangos@google.com> In-Reply-To: <20210618044819.3690166-4-jingzhangos@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Jing Zhang Cc: KVM , KVMARM , LinuxMIPS , KVMPPC , LinuxS390 , Linuxkselftest , Paolo Bonzini , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Will Deacon , Huacai Chen , Aleksandar Markovic , Thomas Bogendoerfer , Paul Mackerras , Christian Borntraeger , Janosch Frank , David Hildenbrand , Cornelia Huck , Claudio Imbrenda , Sean Christopherson , Vitaly Kuznetsov , Jim Mattson , Peter Shier , Oliver Upton , David Rientjes , Emanuele Giuseppe Esposito , David Matlack , Ricardo Koller , Krish Sadhukhan , Fuad Tabba On Fri, Jun 18, 2021 at 04:48:15AM +0000, Jing Zhang wrote: > 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 > Reviewed-by: Ricardo Koller > Reviewed-by: Krish Sadhukhan > Reviewed-by: Fuad Tabba > Tested-by: Fuad Tabba #arm64 > Signed-off-by: Jing Zhang > --- > 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