Re: [PATCH v1 3/3] KVM: arm64: Add histogram stats for handling time of arch specific exit reasons

2021-09-22 Thread Jing Zhang
Hi Marc, Paolo, On Wed, Sep 22, 2021 at 8:37 AM Paolo Bonzini wrote: > > On 22/09/21 13:22, Marc Zyngier wrote: > > Frankly, this is a job for BPF and the tracing subsystem, not for some > > hardcoded syndrome accounting. It would allow to extract meaningful > > information, prevent bloat, and cr

[PATCH v1 1/3] KVM: arm64: Add arch specific exit reasons

2021-09-21 Thread Jing Zhang
Arch specific exit reasons have been available for other architectures. Add arch specific exit reason support for ARM64, which would be used in KVM stats for monitoring VCPU status. Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_emulate.h | 5 +++ arch/arm64/include/asm/kvm_host.h

[PATCH v1 3/3] KVM: arm64: Add histogram stats for handling time of arch specific exit reasons

2021-09-21 Thread Jing Zhang
These logarithmic histogram stats are useful for monitoring performance of handling for different kinds of VCPU exit reasons. Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 36 arch/arm64/kvm/arm.c | 4 ++ arch/arm64/kvm/guest.c| 43

[PATCH v1 2/3] KVM: arm64: Add counter stats for arch specific exit reasons

2021-09-21 Thread Jing Zhang
The exit reason stats can be used for monitoring the VCPU status. Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 33 --- arch/arm64/kvm/guest.c| 33 +++ arch/arm64/kvm/handle_exit.c | 22

Re: [PATCH] KVM: stats: Add VM stat for remote tlb flush requests

2021-08-18 Thread Jing Zhang
Hi Marc, On Wed, Aug 18, 2021 at 1:11 AM Marc Zyngier wrote: > > On Tue, 17 Aug 2021 01:26:39 +0100, > Jing Zhang wrote: > > > > Add a new stat that counts the number of times a remote TLB flush is > > requested, regardless of whether it kicks vCPUs out of guest mode.

[PATCH] KVM: stats: Add VM stat for remote tlb flush requests

2021-08-16 Thread Jing Zhang
Add a new stat that counts the number of times a remote TLB flush is requested, regardless of whether it kicks vCPUs out of guest mode. This allows us to look at how often flushes are initiated. Original-by: David Matlack Signed-off-by: Jing Zhang --- arch/arm64/kvm/mmu.c | 1 + include

Re: [PATCH 1/3] KVM: arm64: Record number of signal exits as a vCPU stat

2021-07-29 Thread Jing Zhang
On Thu, Jul 29, 2021 at 12:56 PM Oliver Upton wrote: > > Most other architectures that implement KVM record a statistic > indicating the number of times a vCPU has exited due to a pending > signal. Add support for that stat to arm64. > > Cc: Jing Zhang > Signed

Re: [PATCH v12 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-21 Thread Jing Zhang
On Mon, Jun 21, 2021 at 6:35 PM Paolo Bonzini wrote: > > On 22/06/21 00:58, Jing Zhang wrote: > >> Pass it as an argument? > > The num_desc can only be initialized in the same file that defines the > > descriptor array. > > Looks like we have to have a

Re: [PATCH v12 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-21 Thread Jing Zhang
On Mon, Jun 21, 2021 at 5:45 PM Paolo Bonzini wrote: > > On 21/06/21 19:46, Jing Zhang wrote: > >> const struct kvm_stats_header kvm_vm_stats_header = { > >> .name_size = KVM_STATS_NAME_SIZE, > >> .num_desc = num_desc, > > The pr

Re: [PATCH v12 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-21 Thread Jing Zhang
On Mon, Jun 21, 2021 at 11:54 AM Paolo Bonzini wrote: > > On 19/06/21 00:27, Jing Zhang wrote: > > +/** > > + * kvm_stats_read() - Common vm/vcpu stats read function to userspace. > > Common function to read from the binary statistics file descriptor. > > > + *

Re: [PATCH v12 4/7] KVM: stats: Support binary stats retrieval for a VCPU

2021-06-21 Thread Jing Zhang
On Mon, Jun 21, 2021 at 11:46 AM Paolo Bonzini wrote: > > On 19/06/21 00:27, Jing Zhang wrote: > > + struct kvm_vcpu_stat stat; > > struct kvm_dirty_ring dirty_ring; > > + char stats_id[KVM_STATS_NAME_SIZE]; > > I think stats_id needs to be part of th

[PATCH v12 4/7] KVM: stats: Support binary stats retrieval for a VCPU

2021-06-18 Thread Jing Zhang
-by: Krish Sadhukhan Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 21 arch/mips/kvm/mips.c | 44 arch/powerpc/kvm/book3s.c | 45 arch/powerpc/kvm/booke.c | 38

[PATCH v12 0/7] KVM statistics data fd-based binary interface

2021-06-18 Thread Jing Zhang
zhan...@google.com [8] https://lore.kernel.org/kvm/20210611124624.1404010-1-jingzhan...@google.com [9] https://lore.kernel.org/kvm/20210614212155.1670777-1-jingzhan...@google.com [10] https://lore.kernel.org/kvm/20210617044146.2667540-1-jingzhan...@google.com [11] https://lore.kernel.org/kvm/202106

[PATCH v12 5/7] KVM: stats: Add documentation for binary statistics interface

2021-06-18 Thread Jing Zhang
tlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Reviewed-by: Fuad Tabba Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 198 - 1 file changed, 197 insertions(+), 1 deletion(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation

[PATCH v12 1/7] KVM: stats: Separate generic stats from architecture specific ones

2021-06-18 Thread Jing Zhang
-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 9 ++--- arch/arm64/kvm/guest.c | 12 ++-- arch/mips/include/asm/kvm_host.h| 9 ++--- arch/mips/kvm/mips.c| 12 ++-- arch

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

2021-06-18 Thread Jing Zhang
: Krish Sadhukhan Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 15 ++ arch/mips/kvm/mips.c | 15 ++ arch/powerpc/kvm/book3s.c | 17 arch/powerpc/kvm/booke.c | 17 arch

[PATCH v12 7/7] KVM: stats: Remove code duplication for binary and debugfs stats

2021-06-18 Thread Jing Zhang
To remove code duplication, use the binary stats descriptors for debugfs interface for KVM stats. Then we only have one stats definitions for both binary and debugfs interface. Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 16 -- arch/mips/kvm/mips.c | 39

[PATCH v12 6/7] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-18 Thread Jing Zhang
Add selftest to check KVM stats descriptors validity. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile

[PATCH v12 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-18 Thread Jing Zhang
eded. 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/Makefile | 2 +- arch/mips/kvm/Makefile| 2 +- arch/powerpc/kvm/Makefile | 2 +- arch/s3

Re: [PATCH v11 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-18 Thread Jing Zhang
Hi Paolo, On Fri, Jun 18, 2021 at 10:51 AM Paolo Bonzini wrote: > > On 18/06/21 10:23, Greg KH wrote: > > On Fri, Jun 18, 2021 at 10:02:57AM +0200, Paolo Bonzini wrote: > >> On 18/06/21 09:00, Greg KH wrote: > +struct kvm_stats_header { > + __u32 name_size; > + __u32 count; > >>>

Re: [PATCH v11 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-18 Thread Jing Zhang
On Fri, Jun 18, 2021 at 3:23 AM Greg KH wrote: > > On Fri, Jun 18, 2021 at 10:02:57AM +0200, Paolo Bonzini wrote: > > On 18/06/21 09:00, Greg KH wrote: > > > > +struct kvm_stats_header { > > > > + __u32 name_size; > > > > + __u32 count; > > > > + __u32 desc_offset; > > > > + __u32 data_offset; > >

Re: [PATCH v11 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-18 Thread Jing Zhang
On Fri, Jun 18, 2021 at 2:01 AM Greg KH wrote: > > On Fri, Jun 18, 2021 at 04:48:14AM +, Jing Zhang wrote: > > This commit defines the API for userspace and prepare the common > > functionalities to support per VM/VCPU binary stats data readings. > > > > The KV

Re: [PATCH v11 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-18 Thread Jing Zhang
On Fri, Jun 18, 2021 at 1:57 AM Greg KH wrote: > > Minor comment nits: > > On Fri, Jun 18, 2021 at 04:48:14AM +, Jing Zhang wrote: > > +/* > > + * Common vm/vcpu stats read function to userspace. > > Should you use a real kernel-doc style here? You almost are

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

2021-06-18 Thread Jing Zhang
On Fri, Jun 18, 2021 at 1:58 AM Greg KH wrote: > > On Fri, Jun 18, 2021 at 04:48:15AM +, 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

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

2021-06-18 Thread Jing Zhang
: 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

[PATCH v11 1/7] KVM: stats: Separate generic stats from architecture specific ones

2021-06-18 Thread Jing Zhang
-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 9 ++--- arch/arm64/kvm/guest.c | 12 ++-- arch/mips/include/asm/kvm_host.h| 9 ++--- arch/mips/kvm/mips.c| 12 ++-- arch

[PATCH v11 0/7] KVM statistics data fd-based binary interface

2021-06-18 Thread Jing Zhang
https://lore.kernel.org/kvm/20210603211426.790093-1-jingzhan...@google.com [8] https://lore.kernel.org/kvm/20210611124624.1404010-1-jingzhan...@google.com [9] https://lore.kernel.org/kvm/20210614212155.1670777-1-jingzhan...@google.com [10] https://lore.kernel.org/kvm/20210617044146.2667540-1-jingzhan...@

[PATCH v11 7/7] KVM: stats: Remove code duplication for binary and debugfs stats

2021-06-18 Thread Jing Zhang
To remove code duplication, use the binary stats descriptors for debugfs interface for KVM stats. Then we only have one stats definitions for both binary and debugfs interface. Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 16 -- arch/mips/kvm/mips.c | 39

[PATCH v11 4/7] KVM: stats: Support binary stats retrieval for a VCPU

2021-06-18 Thread Jing Zhang
-by: Krish Sadhukhan Reviewed-by: Fuad Tabba Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 20 +++ arch/mips/kvm/mips.c | 43 +++ arch/powerpc/kvm/book3s.c | 44 arch/powerpc/kvm/booke.c | 37 + arch

[PATCH v11 5/7] KVM: stats: Add documentation for binary statistics interface

2021-06-18 Thread Jing Zhang
tlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Reviewed-by: Fuad Tabba Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 176 - 1 file changed, 175 insertions(+), 1 deletion(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation

[PATCH v11 2/7] KVM: stats: Add fd-based API to read binary stats data

2021-06-18 Thread Jing Zhang
eded. 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/Makefile | 2 +- arch/mips/kvm/Makefile| 2 +- arch/powerpc/kvm/Makefile | 2 +- arch/s3

[PATCH v11 6/7] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-18 Thread Jing Zhang
Add selftest to check KVM stats descriptors validity. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile

Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
Hi Greg, On Thu, Jun 17, 2021 at 10:20 AM Jing Zhang wrote: > > Hi Greg, > > On Thu, Jun 17, 2021 at 12:56 AM Greg KH wrote: > > > > On Thu, Jun 17, 2021 at 04:41:44AM +, Jing Zhang wrote: > > > + struct kvm_stats_desc { > > > +

Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
On Thu, Jun 17, 2021 at 6:34 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 01:19:50PM +0200, Paolo Bonzini wrote: > > On 17/06/21 08:07, Greg KH wrote: > > > > The statistics data itself could be read out by userspace telemetry > > > > periodically without any extra parsing or setup effort. > > >

Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
On Thu, Jun 17, 2021 at 6:32 AM Paolo Bonzini wrote: > > On 17/06/21 07:56, Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:44AM +, Jing Zhang wrote: > >> +struct kvm_stats_desc { > >> +__u32 flags; > >> +__s16

Re: [PATCH v10 2/5] KVM: stats: Add fd-based API to read binary stats data

2021-06-17 Thread Jing Zhang
On Thu, Jun 17, 2021 at 10:29 AM Paolo Bonzini wrote: > > On 17/06/21 16:56, Jing Zhang wrote: > > Actually, it is really not easy to separate this change into two patches > > even by > > following Paolo's suggestion. And it would be a surprise to userspace to s

Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
Hi Greg, On Thu, Jun 17, 2021 at 1:05 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:44AM +, Jing Zhang wrote: > > +The file descriptor can be used to read VM/vCPU statistics data in binary > > +format. The file data is organized into thr

Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
Hi Greg, On Thu, Jun 17, 2021 at 12:56 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:44AM +, Jing Zhang wrote: > > + struct kvm_stats_desc { > > + __u32 flags; > > + __s16 exponent; > > + __u16 size;

Re: [PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
Hi Greg, On Thu, Jun 17, 2021 at 12:52 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:44AM +, Jing Zhang wrote: > > + struct kvm_stats_desc { > > + __u32 flags; > > + __s16 exponent; > > + __u16 size;

Re: [PATCH v10 2/5] KVM: stats: Add fd-based API to read binary stats data

2021-06-17 Thread Jing Zhang
Hi Greg, On Thu, Jun 17, 2021 at 2:24 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:43AM +, Jing Zhang wrote: > > Provides a file descriptor per VM to read VM stats info/data. > > Provides a file descriptor per vCPU to read vCPU stats info/data. > > Should

Re: [PATCH v10 2/5] KVM: stats: Add fd-based API to read binary stats data

2021-06-17 Thread Jing Zhang
Hi Greg, On Thu, Jun 17, 2021 at 2:03 AM Greg KH wrote: > > On Thu, Jun 17, 2021 at 04:41:43AM +, Jing Zhang wrote: > > Provides a file descriptor per VM to read VM stats info/data. > > Provides a file descriptor per vCPU to read vCPU stats info/data. > > >

[PATCH v10 5/5] KVM: stats: Remove code duplication for binary and debugfs stats

2021-06-17 Thread Jing Zhang
To remove code duplication, use the binary stats descriptors for debugfs interface for KVM stats. Then we only have one stats definitions for both binary and debugfs interface. Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 16 -- arch/mips/kvm/mips.c | 39

[PATCH v10 2/5] KVM: stats: Add fd-based API to read binary stats data

2021-06-17 Thread Jing Zhang
d Tabba Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 38 + arch/mips/kvm/mips.c | 61 ++ arch/powerpc/kvm/book3s.c | 64 +++ arch/powerpc/kvm/booke.c | 57 + arch/s390/kvm/kv

[PATCH v10 1/5] KVM: stats: Separate generic stats from architecture specific ones

2021-06-17 Thread Jing Zhang
-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 9 ++--- arch/arm64/kvm/guest.c | 12 ++-- arch/mips/include/asm/kvm_host.h| 9 ++--- arch/mips/kvm/mips.c| 12 ++-- arch

[PATCH v10 4/5] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-17 Thread Jing Zhang
Add selftest to check KVM stats descriptors validity. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Tested-by: Fuad Tabba #arm64 Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile

[PATCH v10 0/5] KVM statistics data fd-based binary interface

2021-06-17 Thread Jing Zhang
m [6] https://lore.kernel.org/kvm/20210524151828.4113777-1-jingzhan...@google.com [7] https://lore.kernel.org/kvm/20210603211426.790093-1-jingzhan...@google.com [8] https://lore.kernel.org/kvm/20210611124624.1404010-1-jingzhan...@google.com [9] https://lore.kernel.org/kvm/20210614212155.1670777-1-jingzha

[PATCH v10 3/5] KVM: stats: Add documentation for binary statistics interface

2021-06-17 Thread Jing Zhang
tlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Reviewed-by: Fuad Tabba Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 177 - 1 file changed, 176 insertions(+), 1 deletion(-) diff --git a/Documentation/virt/kvm/api.rst b/Documentation

Re: [PATCH v9 4/5] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-16 Thread Jing Zhang
Hi Fuad, On Tue, Jun 15, 2021 at 3:03 AM Fuad Tabba wrote: > > Hi Jing, > > > +int main(int argc, char *argv[]) > > +{ > > + int max_vm = DEFAULT_NUM_VM, max_vcpu = DEFAULT_NUM_VCPU, ret, i, j; > > + struct kvm_vm **vms; > > + > > + /* Get the number of VMs and VCPUs that would

Re: [PATCH v9 2/5] KVM: stats: Add fd-based API to read binary stats data

2021-06-16 Thread Jing Zhang
On Wed, Jun 16, 2021 at 12:12 PM Paolo Bonzini wrote: > > On 14/06/21 23:21, Jing Zhang wrote: > > + /* Copy kvm stats values */ > > + copylen = header->header.data_offset + size_stats - pos; > > + copylen = min(copylen, remain); > > + if (cop

Re: [PATCH 0/4] Remove duplicated stats definitions for debugfs

2021-06-14 Thread Jing Zhang
On Mon, Jun 14, 2021 at 4:53 AM Paolo Bonzini wrote: > > On 14/06/21 04:53, Jing Zhang wrote: > > This is a follow-up patchset to binary stats interface patchset as below: > > https://lore.kernel.org/kvm/20210611124624.1404010-1-jingzhan...@google.com > > > > This

Re: [PATCH 2/4] KVM: stats: Use binary stats descriptors for debugfs interface

2021-06-14 Thread Jing Zhang
Hi Paolo, On Mon, Jun 14, 2021 at 4:51 AM Paolo Bonzini wrote: > > On 14/06/21 04:53, Jing Zhang wrote: > > + STATS_DESC_ICOUNTER_RONLY(VM, lpages), > > + STATS_DESC_ICOUNTER_RONLY(VM, nx_lpage_splits), > > STATS_DESC_ICOUNTER(VM, max_mmu_page_hash_collision

Re: [PATCH 1/4] KVM: stats: Make sure no missing or mismatched binary stats definition

2021-06-14 Thread Jing Zhang
Hi Fuad, On Mon, Jun 14, 2021 at 4:50 AM Fuad Tabba wrote: > > Hi Jing, > > On Mon, Jun 14, 2021 at 3:53 AM Jing Zhang wrote: > > > > Add static check to make sure the number of stats descriptors equals > > the number of stats defined in vm/vcpu stats structures.

Re: [PATCH v7 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-06-14 Thread Jing Zhang
Hi Fuad, On Mon, Jun 14, 2021 at 2:57 AM Fuad Tabba wrote: > > Hi Jing, > > > On Thu, Jun 3, 2021 at 10:14 PM Jing Zhang wrote: > > > > Update KVM API documentation for binary statistics. > > > > Reviewed-by: David Matlack > > Reviewed-by:

[PATCH 1/4] KVM: stats: Make sure no missing or mismatched binary stats definition

2021-06-13 Thread Jing Zhang
some missing/mismatched stats from previous patch. Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 16 +-- arch/mips/kvm/mips.c | 60 ++-- arch/powerpc/kvm/book3s.c | 68 +++-- arch/powerpc/kvm/booke.c | 54 ++- arch/s390/kvm/kvm-s390.c

[PATCH 3/4] KVM: stats: Update documentation supporting stats mode and offset

2021-06-13 Thread Jing Zhang
Update documentation to reflect that stats descriptor supports new flags for read/write mode and an offset field is added in stats descriptor. Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions

[PATCH 0/4] Remove duplicated stats definitions for debugfs

2021-06-13 Thread Jing Zhang
ugh not permitted in VM level in the original debugfs code. --- Jing Zhang (4): KVM: stats: Make sure no missing or mismatched binary stats definition KVM: stats: Use binary stats descriptors for debugfs interface KVM: stats: Update documentation supporting stats mode and offset KVM: self

[PATCH 2/4] KVM: stats: Use binary stats descriptors for debugfs interface

2021-06-13 Thread Jing Zhang
To avoid duplication, use the binary stats descriptors for debugfs interface for KVM stats. Then we only have one stats definitions for both binary and debugfs interface. Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 16 -- arch/mips/kvm/mips.c | 39 -- arch

[PATCH 4/4] KVM: selftests: Update binary stats test for stats mode

2021-06-13 Thread Jing Zhang
Update binary stats selftest to support sanity test for stats read/write mode and offset. Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/kvm_binary_stats_test.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/kvm

Re: [PATCH v7 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-13 Thread Jing Zhang
Hi Faud, On Sun, Jun 13, 2021 at 10:20 AM Fuad Tabba wrote: > > Hi Jing, > > > diff --git a/arch/mips/kvm/mips.c b/arch/mips/kvm/mips.c > > index ff205b35719b..eb8fd4a96952 100644 > > --- a/arch/mips/kvm/mips.c > > +++ b/arch/mips/kvm/mips.c > > @@ -38,6 +38,58 @@ > > #define VECTORSPACING 0x100

Re: [PATCH] KVM: stats: Remove debugfs interface for KVM stats

2021-06-11 Thread Jing Zhang
On Fri, Jun 11, 2021 at 10:18 AM Paolo Bonzini wrote: > > On 11/06/21 17:00, Jing Zhang wrote: > > To avoid duplication, remove the debugfs interface for KVM stats, > > since the fd-based binary stats interface is available. > > That would be too easy. :) We need to keep

Re: [PATCH] KVM: stats: Remove debugfs interface for KVM stats

2021-06-11 Thread Jing Zhang
Hi Paolo, On Fri, Jun 11, 2021 at 10:00 AM Jing Zhang wrote: > > To avoid duplication, remove the debugfs interface for KVM stats, > since the fd-based binary stats interface is available. > > Signed-off-by: Jing Zhang > --- > arch/arm64/kvm/guest.c| 16 --- &g

[PATCH] KVM: stats: Remove debugfs interface for KVM stats

2021-06-11 Thread Jing Zhang
To avoid duplication, remove the debugfs interface for KVM stats, since the fd-based binary stats interface is available. Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 16 --- arch/mips/kvm/mips.c | 39 -- arch/powerpc/kvm/book3s.c | 33 - arch/powerpc/kvm/booke.c

Re: [PATCH v8 0/4] KVM statistics data fd-based binary interface

2021-06-11 Thread Jing Zhang
Hi Paolo, On Fri, Jun 11, 2021 at 8:35 AM Paolo Bonzini wrote: > > On 11/06/21 14:46, Jing Zhang wrote: > > This patchset provides a file descriptor for every VM and VCPU to read > > KVM statistics data in binary format. > > It is meant to provide a lightweight, flexible

[PATCH v8 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-06-11 Thread Jing Zhang
Update KVM API documentation for binary statistics. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 174 - 1 file changed, 173 insertions(+), 1 deletion(-) diff

[PATCH v8 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-11 Thread Jing Zhang
Provides a file descriptor per VM to read VM stats info/data. Provides a file descriptor per vCPU to read vCPU stats info/data. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 34 + arch

[PATCH v8 1/4] KVM: stats: Separate generic stats from architecture specific ones

2021-06-11 Thread Jing Zhang
Put all generic statistics in a separate structure to ease statistics handling for the incoming new statistics API. No functional change intended. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- arch/arm64/include/asm

[PATCH v8 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-11 Thread Jing Zhang
Add selftest to check KVM stats descriptors validity. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Reviewed-by: Krish Sadhukhan Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 3 + .../testing

[PATCH v8 0/4] KVM statistics data fd-based binary interface

2021-06-11 Thread Jing Zhang
jingzhan...@google.com [5] https://lore.kernel.org/kvm/20210517145314.157626-1-jingzhan...@google.com [6] https://lore.kernel.org/kvm/20210524151828.4113777-1-jingzhan...@google.com [7] https://lore.kernel.org/kvm/20210603211426.790093-1-jingzhan...@google.com --- Jing Zhang (4): KVM: stats: Separa

Re: [PATCH v7 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-10 Thread Jing Zhang
Hi Paolo, On Thu, Jun 10, 2021 at 11:23 AM Paolo Bonzini wrote: > > On 03/06/21 23:14, Jing Zhang wrote: > > +#define DEFINE_VM_STATS_DESC(...) { > > \ > > + STATS_DESC_C

Re: [PATCH v7 0/4] KVM statistics data fd-based binary interface

2021-06-10 Thread Jing Zhang
Hi Paolo, On Thu, Jun 10, 2021 at 11:46 AM Paolo Bonzini wrote: > > On 03/06/21 23:14, Jing Zhang wrote: > > This patchset provides a file descriptor for every VM and VCPU to read > > KVM statistics data in binary format. > > It is meant to provide a lightweight, flexible

Re: [PATCH v7 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-10 Thread Jing Zhang
Hi Paolo, On Thu, Jun 10, 2021 at 11:42 AM Paolo Bonzini wrote: > > On 03/06/21 23:14, Jing Zhang wrote: > > +struct _kvm_stats_header { > > + __u32 name_size; > > + __u32 count; > > + __u32 desc_offset; > > + __u32 data_offset; > > +};

Re: [PATCH v7 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-10 Thread Jing Zhang
Hi Paolo, On Thu, Jun 10, 2021 at 11:23 AM Paolo Bonzini wrote: > > On 03/06/21 23:14, Jing Zhang wrote: > > +#define DEFINE_VM_STATS_DESC(...) { > > \ > > + STATS_DESC_C

Re: [PATCH v7 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-07 Thread Jing Zhang
On Mon, Jun 7, 2021 at 2:23 PM Krish Sadhukhan wrote: > > > On 6/3/21 2:14 PM, Jing Zhang wrote: > > Add selftest to check KVM stats descriptors validity. > > > > Reviewed-by: David Matlack > > Reviewed-by: Ricardo Koller > > Signed-off-by: Jing Zhang &g

Re: [PATCH v7 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-07 Thread Jing Zhang
On Mon, Jun 7, 2021 at 2:23 PM Krish Sadhukhan wrote: > > > On 6/3/21 2:14 PM, Jing Zhang wrote: > > Provides a file descriptor per VM to read VM stats info/data. > > Provides a file descriptor per vCPU to read vCPU stats info/data. > > > > Reviewed-by: David

Re: [PATCH v7 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-06-07 Thread Jing Zhang
On Mon, Jun 7, 2021 at 2:23 PM Krish Sadhukhan wrote: > > > On 6/3/21 2:14 PM, Jing Zhang wrote: > > Update KVM API documentation for binary statistics. > > > > Reviewed-by: David Matlack > > Reviewed-by: Ricardo Koller > > Signed-off-by: Jing Zhang >

[PATCH v7 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-06-03 Thread Jing Zhang
Provides a file descriptor per VM to read VM stats info/data. Provides a file descriptor per vCPU to read vCPU stats info/data. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 26 +++ arch/mips/kvm/mips.c | 52

[PATCH v7 1/4] KVM: stats: Separate generic stats from architecture specific ones

2021-06-03 Thread Jing Zhang
Put all generic statistics in a separate structure to ease statistics handling for the incoming new statistics API. No functional change intended. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 9 ++--- arch

[PATCH v7 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-06-03 Thread Jing Zhang
Update KVM API documentation for binary statistics. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 180 + 1 file changed, 180 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b

[PATCH v7 0/4] KVM statistics data fd-based binary interface

2021-06-03 Thread Jing Zhang
.596466-1-jingzhan...@google.com [4] https://lore.kernel.org/kvm/20210429203740.1935629-1-jingzhan...@google.com [5] https://lore.kernel.org/kvm/20210517145314.157626-1-jingzhan...@google.com [6] https://lore.kernel.org/kvm/20210524151828.4113777-1-jingzhan...@google.com --- Jing Zhang (4): KV

[PATCH v7 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-06-03 Thread Jing Zhang
Add selftest to check KVM stats descriptors validity. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 3 + .../testing/selftests/kvm/include/kvm_util.h

Re: [PATCH v6 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-05-27 Thread Jing Zhang
Hi Krish, On Wed, May 26, 2021 at 5:34 PM Krish Sadhukhan wrote: > > > On 5/24/21 8:18 AM, Jing Zhang wrote: > > Add selftest to check KVM stats descriptors validity. > > > > Reviewed-by: David Matlack > > Reviewed-by: Ricardo Koller > > Signed-off-by:

Re: [PATCH v6 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-05-26 Thread Jing Zhang
Hi Krish, On Wed, May 26, 2021 at 1:53 PM Krish Sadhukhan wrote: > > > On 5/24/21 8:18 AM, Jing Zhang wrote: > > Provides a file descriptor per VM to read VM stats info/data. > > Provides a file descriptor per vCPU to read vCPU stats info/data. > > > > Reviewed-

Re: [PATCH v6 1/4] KVM: stats: Separate common stats from architecture specific ones

2021-05-26 Thread Jing Zhang
On Tue, May 25, 2021 at 4:36 PM David Matlack wrote: > > On Mon, May 24, 2021 at 8:18 AM Jing Zhang wrote: > > > > Put all common statistics in a separate structure to ease > > statistics handling for the incoming new statistics API. > > > > No functional

Re: [PATCH v6 1/4] KVM: stats: Separate common stats from architecture specific ones

2021-05-25 Thread Jing Zhang
Hi Krish, On Tue, May 25, 2021 at 2:49 PM Krish Sadhukhan wrote: > > > On 5/24/21 8:18 AM, Jing Zhang wrote: > > Put all common statistics in a separate structure to ease > > statistics handling for the incoming new statistics API. > > > > No functional cha

[PATCH v6 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-05-24 Thread Jing Zhang
Provides a file descriptor per VM to read VM stats info/data. Provides a file descriptor per vCPU to read vCPU stats info/data. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- arch/arm64/kvm/guest.c| 26 ++ arch/mips/kvm/mips.c | 52

[PATCH v6 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-05-24 Thread Jing Zhang
Add selftest to check KVM stats descriptors validity. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- tools/testing/selftests/kvm/.gitignore| 1 + tools/testing/selftests/kvm/Makefile | 3 + .../testing/selftests/kvm/include/kvm_util.h

[PATCH v6 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-05-24 Thread Jing Zhang
Update KVM API documentation for binary statistics. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- Documentation/virt/kvm/api.rst | 179 + 1 file changed, 179 insertions(+) diff --git a/Documentation/virt/kvm/api.rst b

[PATCH v6 0/4] KVM statistics data fd-based binary interface

2021-05-24 Thread Jing Zhang
gzhan...@google.com [3] https://lore.kernel.org/kvm/20210423181727.596466-1-jingzhan...@google.com [4] https://lore.kernel.org/kvm/20210429203740.1935629-1-jingzhan...@google.com [5] https://lore.kernel.org/kvm/20210517145314.157626-1-jingzhan...@google.com --- Jing Zhang (4): KVM: stats: Separ

[PATCH v6 1/4] KVM: stats: Separate common stats from architecture specific ones

2021-05-24 Thread Jing Zhang
Put all common statistics in a separate structure to ease statistics handling for the incoming new statistics API. No functional change intended. Reviewed-by: David Matlack Reviewed-by: Ricardo Koller Signed-off-by: Jing Zhang --- arch/arm64/include/asm/kvm_host.h | 9 ++--- arch

Re: [PATCH v5 1/4] KVM: stats: Separate common stats from architecture specific ones

2021-05-21 Thread Jing Zhang
On Tue, May 18, 2021 at 1:40 PM Krish Sadhukhan wrote: > > > On 5/18/21 10:25 AM, Jing Zhang wrote: > > Hi David, > > > > On Tue, May 18, 2021 at 11:27 AM David Matlack wrote: > >> On Mon, May 17, 2021 at 5:10 PM Jing Zhang wrote: > >> > >&

Re: [PATCH v5 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-05-20 Thread Jing Zhang
On Wed, May 19, 2021 at 5:00 PM Ricardo Koller wrote: > > On Mon, May 17, 2021 at 02:53:14PM +, Jing Zhang wrote: > > Add selftest to check KVM stats descriptors validity. > > > > Signed-off-by: Jing Zhang > > --- > > tools/testing/selftests/kvm/.gitigno

Re: [PATCH v5 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-05-20 Thread Jing Zhang
On Thu, May 20, 2021 at 3:51 PM Ricardo Koller wrote: > > On Thu, May 20, 2021 at 02:46:41PM -0500, Jing Zhang wrote: > > Hi Ricardo, > > > > On Thu, May 20, 2021 at 1:58 PM Ricardo Koller wrote: > > > > > > On Thu, May 20, 2021 at 12:37:59PM -

Re: [PATCH v5 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-05-20 Thread Jing Zhang
Hi Ricardo, On Thu, May 20, 2021 at 1:58 PM Ricardo Koller wrote: > > On Thu, May 20, 2021 at 12:37:59PM -0500, Jing Zhang wrote: > > Hi Ricardo, > > > > On Wed, May 19, 2021 at 11:21 PM Ricardo Koller wrote: > > > > > > On Mon, May 17,

Re: [PATCH v5 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-05-20 Thread Jing Zhang
Hi Ricardo, On Wed, May 19, 2021 at 11:21 PM Ricardo Koller wrote: > > On Mon, May 17, 2021 at 02:53:12PM +, Jing Zhang wrote: > > Provides a file descriptor per VM to read VM stats info/data. > > Provides a file descriptor per vCPU to read vCPU stats info/data. > >

Re: [PATCH v5 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-05-19 Thread Jing Zhang
Hi Ricardo, On Wed, May 19, 2021 at 5:00 PM Ricardo Koller wrote: > > On Mon, May 17, 2021 at 02:53:14PM +, Jing Zhang wrote: > > Add selftest to check KVM stats descriptors validity. > > > > Signed-off-by: Jing Zhang > > --- > > tools/testing/s

Re: [PATCH v5 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-05-19 Thread Jing Zhang
On Wed, May 19, 2021 at 2:29 PM Jing Zhang wrote: > > Hi David, > > On Wed, May 19, 2021 at 11:57 AM David Matlack wrote: > > > > On Mon, May 17, 2021 at 9:25 AM Jing Zhang wrote: > > > > > > Update KVM API documentation for binary statist

Re: [PATCH v5 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-05-19 Thread Jing Zhang
Hi David, On Wed, May 19, 2021 at 12:02 PM David Matlack wrote: > > On Mon, May 17, 2021 at 9:25 AM Jing Zhang wrote: > > > > Update KVM API documentation for binary statistics. > > > > Signed-off-by: Jing Zhang > > --- >

Re: [PATCH v5 3/4] KVM: stats: Add documentation for statistics data binary interface

2021-05-19 Thread Jing Zhang
Hi David, On Wed, May 19, 2021 at 11:57 AM David Matlack wrote: > > On Mon, May 17, 2021 at 9:25 AM Jing Zhang wrote: > > > > Update KVM API documentation for binary statistics. > > > > Signed-off-by: Jing Zhang > > --- >

Re: [PATCH v5 2/4] KVM: stats: Add fd-based API to read binary stats data

2021-05-19 Thread Jing Zhang
Hi David, On Wed, May 19, 2021 at 12:13 PM David Matlack wrote: > > On Mon, May 17, 2021 at 9:32 AM Jing Zhang wrote: > > > > Provides a file descriptor per VM to read VM stats info/data. > > Provides a file descriptor per vCPU to read vCPU stats info/data. > >

Re: [PATCH v5 4/4] KVM: selftests: Add selftest for KVM statistics data binary interface

2021-05-19 Thread Jing Zhang
Hi David, On Wed, May 19, 2021 at 12:22 PM David Matlack wrote: > > On Mon, May 17, 2021 at 9:24 AM Jing Zhang wrote: > > > > Add selftest to check KVM stats descriptors validity. > > > > Signed-off-by: Jing Zhang > > --- > > tools/testing/selftest

  1   2   >