Re: [RFC PATCH 01/37] KVM: x86/mmu: Store the address space ID directly in kvm_mmu_page_role

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 11:50:29PM +0100, Paolo Bonzini wrote: > On 12/12/22 18:39, Sean Christopherson wrote: > > > The notion of address spaces is already existing architecture-neutral > > > concept in KVM (e.g. see uses of KVM_ADDRESS_SPACE_NUM in > > > virt/kvm/kvm_main.c), although SMM is the

Re: [RFC PATCH 01/37] KVM: x86/mmu: Store the address space ID directly in kvm_mmu_page_role

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 06:17:36PM +, Oliver Upton wrote: > On Mon, Dec 12, 2022 at 05:39:38PM +, Sean Christopherson wrote: > > On Fri, Dec 09, 2022, David Matlack wrote: > > > On Fri, Dec 9, 2022 at 9:25 AM Oliver Upton > > > wrote: > > My preferenc

Re: [RFC PATCH 02/37] KVM: MMU: Move struct kvm_mmu_page_role into common code

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 3:11 PM Paolo Bonzini wrote: > > On 12/8/22 20:38, David Matlack wrote: > > +/* > > + * kvm_mmu_page_role tracks the properties of a shadow page (where shadow > > page > > + * also includes TDP pages) to determine whether or not a page c

Re: [RFC PATCH 06/37] KVM: MMU: Move struct kvm_mmu_page to common code

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 2:32 PM Paolo Bonzini wrote: > > On 12/8/22 20:38, David Matlack wrote: > > This commit increases the size of struct kvm_mmu_page by 64 bytes on > > x86_64 (184 bytes -> 248 bytes). The size of this struct can be reduced > > in future commits by

Re: [RFC PATCH 33/37] KVM: Move kvm_arch_flush_remote_tlbs_memslot() to common code

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 2:03 PM Ben Gardon wrote: > > On Thu, Dec 8, 2022 at 11:40 AM David Matlack wrote: > > > > Move kvm_arch_flush_remote_tlbs_memslot() to common code and drop > > "arch_" from the name. kvm_arch_flush_remote_tlbs_memslot() is just a >

Re: [RFC PATCH 10/37] KVM: MMU: Move struct kvm_page_fault to common code

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 10:24:31AM -0800, Ben Gardon wrote: > On Thu, Dec 8, 2022 at 11:39 AM David Matlack wrote: > > > > Move struct kvm_page_fault to common code. This will be used in a future > > commit to move the TDP MMU to common code. > > > > No functiona

Re: [RFC PATCH 20/37] KVM: x86/mmu: Abstract away computing the max mapping level

2022-12-12 Thread David Matlack
On Mon, Dec 12, 2022 at 11:32 AM Ben Gardon wrote: > > On Thu, Dec 8, 2022 at 11:39 AM David Matlack wrote: > > > > Abstract away kvm_mmu_max_mapping_level(), which is an x86-specific > > function for computing the max level that a given GFN can be mapped in > > K

Re: [RFC PATCH 00/37] KVM: Refactor the KVM/x86 TDP MMU into common code

2022-12-09 Thread David Matlack
On Fri, Dec 9, 2022 at 11:07 AM Oliver Upton wrote: > > On Thu, Dec 08, 2022 at 11:38:20AM -0800, David Matlack wrote: > > >Also do we want to keep "TDP" or switch > >to something more familiar across architectures (e.g. ARM and RISC-V > >both

Re: [RFC PATCH 23/37] KVM: MMU: Move VM-level TDP MMU state to struct kvm

2022-12-09 Thread David Matlack
On Fri, Dec 9, 2022 at 9:32 AM Oliver Upton wrote: > > Hey David, > > On Thu, Dec 08, 2022 at 11:38:43AM -0800, David Matlack wrote: > > Move VM-level TDP MMU state to struct kvm so it can be accessed by > > common code in a future commit. > > > > No funct

Re: [RFC PATCH 01/37] KVM: x86/mmu: Store the address space ID directly in kvm_mmu_page_role

2022-12-09 Thread David Matlack
On Fri, Dec 9, 2022 at 9:25 AM Oliver Upton wrote: > > On Fri, Dec 09, 2022 at 10:37:47AM +0800, Yang, Weijiang wrote: > > > > On 12/9/2022 3:38 AM, David Matlack wrote: > > > Rename kvm_mmu_page_role.smm with kvm_mmu_page_role.as_id and use it > > > directl

[RFC PATCH 37/37] KVM: MMU: Move the TDP MMU to common code

2022-12-08 Thread David Matlack
Move tdp_mmu.[ch] from arch/x86 and into the common code directories. This will allow other architectures to use the TDP MMU in the future. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/Makefile | 2 +- arch/x86/kvm/mmu/mmu.c

[RFC PATCH 36/37] KVM: x86/mmu: Move is_tdp_mmu_page() to mmu_internal.h

2022-12-08 Thread David Matlack
Move is_tdp_mmu_page(), which is x86-specific, into mmu_internal.h. This prepares for moving tdp_mmu.h into common code. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu_internal.h | 9 + arch/x86/kvm/mmu/tdp_mmu.h | 9 - 2 files changed

[RFC PATCH 32/37] KVM: Allow range-based TLB invalidation from common code

2022-12-08 Thread David Matlack
. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu_internal.h | 1 - include/linux/kvm_host.h| 1 + virt/kvm/kvm_main.c | 9 + 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/arch/x86/kvm/mmu/mmu_internal.h b/arch/x86/kvm/mmu/mmu_internal.h index

[RFC PATCH 34/37] KVM: MMU: Move the TDP iterator to common code

2022-12-08 Thread David Matlack
Move arch/x86/kvm/mmu/tdp_iter.{c,h} to into common code so that it can be used by other architectures in the future. No functional change intended. Signed-off-by: David Matlack --- MAINTAINERS | 2 +- arch/x86/kvm/Makefile| 2 +- arch

[RFC PATCH 35/37] KVM: x86/mmu: Move tdp_mmu_max_gfn_exclusive() to tdp_pgtable.c

2022-12-08 Thread David Matlack
Move tdp_mmu_max_gfn_exclusive() to tdp_pgtable.c since it currently relies on the x86-specific kvm_mmu_max_gfn() function. This can be improved in the future by implementing a common API for calculating the max GFN. No functional change intended. Signed-off-by: David Matlack --- arch/x86

[RFC PATCH 26/37] KVM: Move page table cache to struct kvm_vcpu

2022-12-08 Thread David Matlack
(MIPS does not set __GFP_ZERO.) This eliminates a dependency of the TDP MMU on an architecture-specific field, which will be used in a future commit to move the TDP MMU to common code. Signed-off-by: David Matlack --- arch/arm64/include/asm/kvm_host.h | 3 --- arch/arm64/kvm/arm.c | 4

[RFC PATCH 33/37] KVM: Move kvm_arch_flush_remote_tlbs_memslot() to common code

2022-12-08 Thread David Matlack
t use that and drop a bunch of duplicate code from the arch directories. Note this adds a lockdep assertion for slot_lock being held when calling kvm_flush_remote_tlbs_memslot(), which was previously only asserted on x86. Signed-off-by: David Matlack --- arch/arm64/kvm/arm.c | 6 -- arc

[RFC PATCH 30/37] KVM: x86/mmu: Rename kvm_flush_remote_tlbs_with_address()

2022-12-08 Thread David Matlack
functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu.c | 32 ++-- arch/x86/kvm/mmu/mmu_internal.h | 3 +-- arch/x86/kvm/mmu/paging_tmpl.h | 4 ++-- arch/x86/kvm/mmu/tdp_mmu.c | 7 +++ 4 files changed, 20 insertions(+), 26

[RFC PATCH 31/37] KVM: x86/MMU: Use gfn_t in kvm_flush_remote_tlbs_range()

2022-12-08 Thread David Matlack
Use gfn_t instead of u64 for the start_gfn parameter to kvm_flush_remote_tlbs_range(), since that is the standard type for GFNs throughout KVM. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu.c | 2 +- arch/x86/kvm/mmu/mmu_internal.h | 2 +- 2

[RFC PATCH 29/37] KVM: x86/mmu: Collapse kvm_flush_remote_tlbs_with_{range, address}() together

2022-12-08 Thread David Matlack
Collapse kvm_flush_remote_tlbs_with_range() and kvm_flush_remote_tlbs_with_address() into a single function. This eliminates some lines of code and a useless NULL check on the range struct. Opportunistically switch from ENOTSUPP to EOPNOTSUPP to make checkpatch happy. Signed-off-by: David

[RFC PATCH 24/37] KVM: x86/mmu: Move kvm_mmu_hugepage_adjust() up to fault handler

2022-12-08 Thread David Matlack
ional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu.c | 6 -- arch/x86/kvm/mmu/tdp_mmu.c | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c index 0593d4a60139..9307608ae975 100644 --- a/arch/x86/kv

[RFC PATCH 27/37] KVM: MMU: Move mmu_page_header_cache to common code

2022-12-08 Thread David Matlack
the code to manage this cache to common code. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu.c | 11 +-- arch/x86/kvm/mmu/mmu_internal.h | 2 -- arch/x86/kvm/mmu/tdp_mmu.c | 2 +- include/kvm/mmu.h | 2 ++ include/li

[RFC PATCH 25/37] KVM: x86/mmu: Pass root role to kvm_tdp_mmu_get_vcpu_root_hpa()

2022-12-08 Thread David Matlack
Pass the root role from the caller rather than grabbing it from vcpu->arch.mmu. This will enable the TDP MMU to be moved to common code in a future commit by removing a dependency on vcpu->arch. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu.c

[RFC PATCH 28/37] KVM: MMU: Stub out tracepoints on non-x86 architectures

2022-12-08 Thread David Matlack
Create stub tracepoints outside of x86. The KVM MMU tracepoints can be moved to common code, but will be deferred to a future commit. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/tdp_mmu.c | 2 +- include/kvm/mmutrace.h | 17 + 2 files

[RFC PATCH 23/37] KVM: MMU: Move VM-level TDP MMU state to struct kvm

2022-12-08 Thread David Matlack
Move VM-level TDP MMU state to struct kvm so it can be accessed by common code in a future commit. No functional change intended. Signed-off-by: David Matlack --- arch/x86/include/asm/kvm_host.h | 39 arch/x86/kvm/mmu/tdp_mmu.c | 40

[RFC PATCH 22/37] KVM: x86: Select HAVE_TDP_MMU if X86_64

2022-12-08 Thread David Matlack
In preparation for moving the TDP MMU implementation into virt/kvm/ guarded behind HAVE_TDP_MMU, ensure that HAVE_TDP_MMU is selected in X86_64 builds that enable KVM. This matches the existing behavior of the TDP MMU in x86. No functional change intended. Signed-off-by: David Matlack --- arch

[RFC PATCH 21/37] KVM: Introduce CONFIG_HAVE_TDP_MMU

2022-12-08 Thread David Matlack
-off-by: David Matlack --- virt/kvm/Kconfig | 3 +++ 1 file changed, 3 insertions(+) diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig index 9fb1ff6f19e5..75d86794d6cf 100644 --- a/virt/kvm/Kconfig +++ b/virt/kvm/Kconfig @@ -92,3 +92,6 @@ config KVM_XFER_TO_GUEST_WORK config HAVE_KVM_PM_NOTIFIER

[RFC PATCH 20/37] KVM: x86/mmu: Abstract away computing the max mapping level

2022-12-08 Thread David Matlack
n-x86 architectures that just returns the max level. This will result in more zapping than necessary when disabling dirty logging (i.e. less than optimal performance) but no correctness issues. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/tdp_mmu.c | 14 ++ arch/x86/kvm/mmu/tdp_pgtable.c

[RFC PATCH 18/37] KVM: x86/mmu: Add common API for creating TDP PTEs

2022-12-08 Thread David Matlack
architecture-specific code. No functional change intended. Signed-off-by: David Matlack --- arch/x86/include/asm/kvm/tdp_pgtable.h | 10 +++ arch/x86/kvm/mmu/tdp_mmu.c | 18 + arch/x86/kvm/mmu/tdp_pgtable.c | 36 ++ 3 files changed, 52

[RFC PATCH 19/37] KVM: x86/mmu: Add arch hooks for NX Huge Pages

2022-12-08 Thread David Matlack
MMU. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/tdp_mmu.c | 57 +++--- arch/x86/kvm/mmu/tdp_pgtable.c | 52 +++ 2 files changed, 84 insertions(+), 25 deletions(-) diff --git a/arch/x86/kvm/mmu

[RFC PATCH 17/37] KVM: Move struct kvm_gfn_range to kvm_types.h

2022-12-08 Thread David Matlack
Move struct kvm_gfn_range to kvm_types.h so that it's definition can be accessed in a future commit by arch/x86/include/asm/kvm/tdp_pgtable.h without needing to include the mega-header kvm_host.h. No functional change intended. Signed-off-by: David Matlack --- include/linux/kvm_host.h

[RFC PATCH 14/37] KVM: MMU: Introduce common macros for TDP page tables

2022-12-08 Thread David Matlack
overrides for any of these macros in the future on a case by case basis. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/tdp_iter.c | 14 +++--- arch/x86/kvm/mmu/tdp_iter.h | 3 ++- arch/x86/kvm/mmu/tdp_mmu.c | 24 +--- include/kvm/tdp_pgtable.h | 21

[RFC PATCH 15/37] KVM: x86/mmu: Add a common API for inspecting/modifying TDP PTEs

2022-12-08 Thread David Matlack
() tdp_pte_clear_accessed() Note that this does not cover constructing PTEs from scratch (e.g. during page fault handling). This will be added in a subsequent commit. Signed-off-by: David Matlack --- arch/x86/include/asm/kvm/tdp_pgtable.h | 58 + arch/x86/kvm/Makefile | 2 +- arch/x86

[RFC PATCH 08/37] KVM: selftests: Stop assuming stats are contiguous in kvm_binary_stats_test

2022-12-08 Thread David Matlack
_data, as that is now always true by construction. Fixes: 0b45d58738cd ("KVM: selftests: Add selftest for KVM statistics data binary interface") Signed-off-by: Jing Zhang Signed-off-by: David Matlack [Re-worded the commit message.] Signed-off-by: David Matlack --- tools/testin

[RFC PATCH 16/37] KVM: x86/mmu: Abstract away TDP MMU root lookup

2022-12-08 Thread David Matlack
Abstract the code that looks up the TDP MMU root from vcpu->arch.mmu behind a function, tdp_mmu_root(). This will be used in a future commit to allow the TDP MMU to be moved to common code, where vcpu->arch.mmu cannot be accessed directly. Signed-off-by: David Matlack --- arch/x86/inclu

[RFC PATCH 11/37] KVM: MMU: Move RET_PF_* into common code

2022-12-08 Thread David Matlack
Move the RET_PF_* enum into common code in preparation for moving the TDP MMU into common code. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu_internal.h | 28 include/kvm/mmu_types.h | 26 ++ 2 files changed, 26 insertions

[RFC PATCH 13/37] KVM: MMU: Move sptep_to_sp() to common code

2022-12-08 Thread David Matlack
Move sptep_to_sp() to common code in preparation for moving the TDP MMU to common code. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/spte.h | 14 ++ include/kvm/mmu.h | 19 +++ 2 files changed, 21 insertions(+), 12 deletions

[RFC PATCH 12/37] KVM: x86/mmu: Use PG_LEVEL_{PTE, PMD, PUD} in the TDP MMU

2022-12-08 Thread David Matlack
Use PG_LEVEL_{PTE,PMD,PUD} in the TDP MMU instead of the x86-specific PG_LEVEL_{4K,2M,1G} aliases. This prepares for moving the TDP MMU to common code, where not all architectures will have 4K PAGE_SIZE. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu

[RFC PATCH 10/37] KVM: MMU: Move struct kvm_page_fault to common code

2022-12-08 Thread David Matlack
Move struct kvm_page_fault to common code. This will be used in a future commit to move the TDP MMU to common code. No functional change intended. Signed-off-by: David Matlack --- arch/x86/include/asm/kvm/mmu_types.h | 20 +++ arch/x86/kvm/mmu/mmu.c | 19 +++ arch/x86/kvm

[RFC PATCH 06/37] KVM: MMU: Move struct kvm_mmu_page to common code

2022-12-08 Thread David Matlack
ate struct and by dynamically allocating fields only used by the Shadow MMU. No functional change intended. Signed-off-by: David Matlack --- arch/x86/include/asm/kvm/mmu_types.h | 62 ++ arch/x86/include/asm/kvm_host.h | 4 - arch/x86/kvm/mmu/mmu.c |

[RFC PATCH 07/37] mm: Introduce architecture-neutral PG_LEVEL macros

2022-12-08 Thread David Matlack
nt code to architecture-neutral code. Signed-off-by: David Matlack --- arch/x86/include/asm/pgtable_types.h | 12 include/linux/mm_types.h | 9 + 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/arch/x86/include/asm/pgtable_types.h b/arch/x86/i

[RFC PATCH 05/37] KVM: x86/mmu: Unify TDP MMU and Shadow MMU root refcounts

2022-12-08 Thread David Matlack
, refcount_dec_and_test() returns true if the resulting refcount is 0. Hence the check in mmu_free_root_page() is inverted to check if shadow root refcount is 0. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu.c | 14 +++--- arch/x86/kvm/mmu/mmu_internal.h | 6 ++ arch/x86/kvm

[RFC PATCH 09/37] KVM: Move page size stats into common code

2022-12-08 Thread David Matlack
these stats on x86, since that's currently the only architecture that populates them. Signed-off-by: David Matlack --- arch/x86/include/asm/kvm_host.h | 8 arch/x86/kvm/mmu.h | 5 - arch/x86/kvm/x86.c | 6 +++--- include/linux/kvm_host.h

[RFC PATCH 03/37] KVM: MMU: Move tdp_ptep_t into common code

2022-12-08 Thread David Matlack
Move the definition of tdp_ptep_t into kvm/mmu_types.h so it can be used from common code in future commits. No functional changed intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mmu_internal.h | 2 -- include/kvm/mmu_types.h | 2 ++ 2 files changed, 2 insertions(+), 2

[RFC PATCH 04/37] KVM: x86/mmu: Invert sp->tdp_mmu_page to sp->shadow_mmu_page

2022-12-08 Thread David Matlack
Invert the meaning of sp->tdp_mmu_page and rename it accordingly. This allows the TDP MMU code to not care about this field, which will be used in a subsequent commit to move the TDP MMU to common code. No functional change intended. Signed-off-by: David Matlack --- arch/x86/kvm/mmu/mm

[RFC PATCH 00/37] KVM: Refactor the KVM/x86 TDP MMU into common code

2022-12-08 Thread David Matlack
86 (unrelated to this refactor). Thanks. P.S. Looking to the future... This is just the first step toward building a common TDP MMU for KVM. After this, We are looking at adding KUnit testing to the common TDP MMU as a way to offset the risk of sharing more code across architectures, and then tar

[RFC PATCH 02/37] KVM: MMU: Move struct kvm_mmu_page_role into common code

2022-12-08 Thread David Matlack
Move struct kvm_mmu_page_role into common code, and move all x86-specific fields into a separate sub-struct within the role, kvm_mmu_page_role_arch. Signed-off-by: David Matlack --- MAINTAINERS | 4 +- arch/x86/include/asm/kvm/mmu_types.h | 56 ++ arch/x86

[RFC PATCH 01/37] KVM: x86/mmu: Store the address space ID directly in kvm_mmu_page_role

2022-12-08 Thread David Matlack
Rename kvm_mmu_page_role.smm with kvm_mmu_page_role.as_id and use it directly as the address space ID throughout the KVM MMU code. This eliminates a needless level of indirection, kvm_mmu_role_as_id(), and prepares for making kvm_mmu_page_role architecture-neutral. Signed-off-by: David Matlack

Re: disabling halt polling broken? (was Re: [PATCH 00/14] KVM: Halt-polling fixes, cleanups and a new stat)

2022-11-16 Thread David Matlack
On Tue, Nov 15, 2022 at 11:28:56AM +0800, wangyanan (Y) wrote: > Hi Sean, Paolo, > > I recently also notice the behavior change of param halt_poll_ns. > Now it loses the ability to: > 1) dynamically disable halt polling for all the running VMs > by `echo 0 > /sys` > 2) dynamically adjust the halt

Re: [PATCH 06/14] KVM: Drop obsolete kvm_arch_vcpu_block_finish()

2021-09-29 Thread David Matlack
On Fri, Sep 24, 2021 at 05:55:20PM -0700, Sean Christopherson wrote: > Drop kvm_arch_vcpu_block_finish() now that all arch implementations are > nops. > > No functional change intended. > > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- >

Re: [PATCH 14/14] KVM: x86: Invoke kvm_vcpu_block() directly for non-HALTED wait states

2021-09-29 Thread David Matlack
7;t > overloaded on x86, e.g. in KVM's stats. Skipping halt-polling for WFS > (and RESET_HOLD) has no meaningful effect on guest performance as there > are typically single-digit numbers of INIT-SIPI sequences per AP vCPU, > per boot, versus thousands of HLTs just to boot to

Re: [PATCH 02/14] KVM: Update halt-polling stats if and only if halt-polling was attempted

2021-09-29 Thread David Matlack
gram stats into the helper to > resolve a discrepancy in what is considered a "successful" halt-poll. > > No functional change intended. > > Cc: David Matlack > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > virt/kvm/kvm_main.c | 8 +-

Re: [PATCH 12/14] KVM: Don't redo ktime_get() when calculating halt-polling stop/deadline

2021-09-29 Thread David Matlack
d. And if the branch is > mispredicted, arguably that extra latency should count toward the > halt-polling time. > > In all likelihood, the numbers involved are in the noise and either > approach is perfectly ok. > > Signed-off-by: Sean Christopherson Reviewed-by: David Matlac

Re: [PATCH 13/14] KVM: x86: Directly block (instead of "halting") UNINITIALIZED vCPUs

2021-09-29 Thread David Matlack
'0', and so KVM will not attempt > halt-polling, i.e. this really only affects the post-block bookkeeping. > > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > arch/x86/kvm/x86.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >

Re: [PATCH 03/14] KVM: Refactor and document halt-polling stats update helper

2021-09-29 Thread David Matlack
uce the > line length for the call site so that it fits on a single line, and so > that the prototype conforms to the more traditional kernel style. > > No functional change intended. > > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > virt

Re: [PATCH 10/14] KVM: Split out a kvm_vcpu_block() helper from kvm_vcpu_halt()

2021-09-29 Thread David Matlack
> > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > include/linux/kvm_host.h | 1 + > virt/kvm/kvm_main.c | 50 > 2 files changed, 36 insertions(+), 15 deletions(-) > > diff --git a/include/linux/kvm_host.

Re: [PATCH 04/14] KVM: Reconcile discrepancies in halt-polling stats

2021-09-29 Thread David Matlack
stead of > using "cur". But that change is desirable as it means all the stats are > now updated with the same polling time, and avoids the extra ktime_get(), > which isn't expensive but isn't free either. > > Signed-off-by: Sean Christopherson Reviewed-by: Davi

Re: [PATCH 09/14] KVM: Rename kvm_vcpu_block() => kvm_vcpu_halt()

2021-09-29 Thread David Matlack
o handle > non-halt cases where the vCPU is not runnable. > > Rename block_ns to halt_ns to match the new function name. > > Opportunistically move an x86-specific comment to x86, and enhance it, too. > > No functional change intended. > > Signed-off-by: Se

Re: [PATCH 11/14] KVM: stats: Add stat to detect if vcpu is currently blocking

2021-09-29 Thread David Matlack
lly-by: Cannon Matthews > Suggested-by: Sean Christopherson > Signed-off-by: Jing Zhang > [sean: renamed stat to "blocking", massaged changelog] > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > include/linux/kvm_host.h | 3 ++- > include/linux

Re: [PATCH 08/14] KVM: x86: Tweak halt emulation helper names to free up kvm_vcpu_halt()

2021-09-29 Thread David Matlack
o functional change intended. > > Signed-off-by: Sean Christopherson Reviewed-by: David Matlack > --- > arch/x86/include/asm/kvm_host.h | 2 +- > arch/x86/kvm/vmx/nested.c | 2 +- > arch/x86/kvm/vmx/vmx.c | 4 ++-- > arch/x86/kvm/x86.c | 1

Re: disabling halt polling broken? (was Re: [PATCH 00/14] KVM: Halt-polling fixes, cleanups and a new stat)

2021-09-27 Thread David Matlack
On Mon, Sep 27, 2021 at 8:17 AM Christian Borntraeger wrote: > > > > Am 27.09.21 um 17:03 schrieb Paolo Bonzini: > > On 27/09/21 16:59, Sean Christopherson wrote: > >>> commit acd05785e48c01edb2c4f4d014d28478b5f19fb5 > >>> Author: David Matlack > &

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

2021-09-23 Thread David Matlack
On Wed, Sep 22, 2021 at 11:53 AM Marc Zyngier wrote: > > On Wed, 22 Sep 2021 19:13:40 +0100, > Sean Christopherson wrote: > > > Stepping back a bit, this is one piece of the larger issue of how to > > modernize KVM for hyperscale usage. BPF and tracing are great when > > the debugger has root ac

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

2021-05-26 Thread David Matlack
On Mon, May 24, 2021 at 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: Jing Zhang Reviewed-by: David Matlack > --- > tools/testing/selftests/kvm

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

2021-05-26 Thread David Matlack
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 change intended. > > Reviewed-by: David Matlack FYI I think you only add Reviewe

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

2021-05-26 Thread David Matlack
On Mon, May 24, 2021 at 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-by: David Matlack > Reviewed-by: Ricardo Koller > Signed-off-by: Jing Zha

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

2021-05-26 Thread David Matlack
On Mon, May 24, 2021 at 8:18 AM Jing Zhang wrote: > > Update KVM API documentation for binary statistics. > > Reviewed-by: David Matlack > Reviewed-by: Ricardo Koller > Signed-off-by: Jing Zhang Reviewed-by: David Matlack > --- > Documentatio

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

2021-05-20 Thread David Matlack
On Mon, May 17, 2021 at 9:25 AM Jing Zhang wrote: > > Update KVM API documentation for binary statistics. > > Signed-off-by: Jing Zhang > --- > Documentation/virt/kvm/api.rst | 171 + > 1 file changed, 171 insertions(+) > > diff --git a/Documentation/virt/kvm/api.

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

2021-05-20 Thread David Matlack
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/selftests/kvm/.gitignore| 1 + > tools/testing/selftests/kvm/Makefile | 3 + > .../testing/selftests/kvm/include/kv

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

2021-05-20 Thread David Matlack
On Mon, May 17, 2021 at 9:25 AM Jing Zhang wrote: > > Update KVM API documentation for binary statistics. > > Signed-off-by: Jing Zhang > --- > Documentation/virt/kvm/api.rst | 171 + > 1 file changed, 171 insertions(+) > > diff --git a/Documentation/virt/kvm/api.

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

2021-05-20 Thread David Matlack
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. > > Signed-off-by: Jing Zhang > --- > arch/arm64/kvm/guest.c| 26 + > arch/mips/kvm/mips.c | 52 +

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

2021-05-18 Thread David Matlack
On Mon, May 17, 2021 at 5:10 PM Jing Zhang wrote: > Actually the definition of kvm_{vcpu,vm}_stat are arch specific. There is > no real structure for arch agnostic stats. Most of the stats in common > structures are arch agnostic, but not all of them. > There are some benefits to put all common s

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

2021-05-18 Thread David Matlack
On Mon, May 17, 2021 at 9:24 AM Jing Zhang wrote: > > Put all common statistics in a separate structure to ease > statistics handling for the incoming new statistics API. > > No functional change intended. > > Signed-off-by: Jing Zhang > --- > arch/arm64/include/asm/kvm_host.h | 9 ++--- >