From: Paolo Bonzini <pbonzini@redhat.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Ben Gardon <bgardon@google.com>,
Makarand Sonare <makarandsonare@google.com>
Subject: Re: [PATCH 08/14] KVM: x86/mmu: Make dirty log size hook (PML) a value, not a function
Date: Thu, 18 Feb 2021 13:45:37 +0100 [thread overview]
Message-ID: <9bb705c8-101d-5f20-bffd-ccd44cbaf663@redhat.com> (raw)
In-Reply-To: <20210213005015.1651772-9-seanjc@google.com>
On 13/02/21 01:50, Sean Christopherson wrote:
> Store the vendor-specific dirty log size in a variable, there's no need
> to wrap it in a function since the value is constant after
> hardware_setup() runs.
For now... :)
Paolo
> Signed-off-by: Sean Christopherson <seanjc@google.com>
> ---
> arch/x86/include/asm/kvm-x86-ops.h | 1 -
> arch/x86/include/asm/kvm_host.h | 2 +-
> arch/x86/kvm/mmu/mmu.c | 5 +----
> arch/x86/kvm/vmx/vmx.c | 9 ++-------
> 4 files changed, 4 insertions(+), 13 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm-x86-ops.h b/arch/x86/include/asm/kvm-x86-ops.h
> index 355a2ab8fc09..28c07cc01474 100644
> --- a/arch/x86/include/asm/kvm-x86-ops.h
> +++ b/arch/x86/include/asm/kvm-x86-ops.h
> @@ -97,7 +97,6 @@ KVM_X86_OP_NULL(slot_enable_log_dirty)
> KVM_X86_OP_NULL(slot_disable_log_dirty)
> KVM_X86_OP_NULL(flush_log_dirty)
> KVM_X86_OP_NULL(enable_log_dirty_pt_masked)
> -KVM_X86_OP_NULL(cpu_dirty_log_size)
> KVM_X86_OP_NULL(pre_block)
> KVM_X86_OP_NULL(post_block)
> KVM_X86_OP_NULL(vcpu_blocking)
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index 84499aad01a4..fb59933610d9 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1294,7 +1294,7 @@ struct kvm_x86_ops {
> void (*enable_log_dirty_pt_masked)(struct kvm *kvm,
> struct kvm_memory_slot *slot,
> gfn_t offset, unsigned long mask);
> - int (*cpu_dirty_log_size)(void);
> + int cpu_dirty_log_size;
>
> /* pmu operations of sub-arch */
> const struct kvm_pmu_ops *pmu_ops;
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index d5849a0e3de1..6c32e8e0f720 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -1294,10 +1294,7 @@ void kvm_arch_mmu_enable_log_dirty_pt_masked(struct kvm *kvm,
>
> int kvm_cpu_dirty_log_size(void)
> {
> - if (kvm_x86_ops.cpu_dirty_log_size)
> - return static_call(kvm_x86_cpu_dirty_log_size)();
> -
> - return 0;
> + return kvm_x86_ops.cpu_dirty_log_size;
> }
>
> bool kvm_mmu_slot_gfn_write_protect(struct kvm *kvm,
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index b47ed3f412ef..f843707dd7df 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -7650,11 +7650,6 @@ static bool vmx_check_apicv_inhibit_reasons(ulong bit)
> return supported & BIT(bit);
> }
>
> -static int vmx_cpu_dirty_log_size(void)
> -{
> - return enable_pml ? PML_ENTITY_NUM : 0;
> -}
> -
> static struct kvm_x86_ops vmx_x86_ops __initdata = {
> .hardware_unsetup = hardware_unsetup,
>
> @@ -7758,6 +7753,7 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = {
> .slot_disable_log_dirty = vmx_slot_disable_log_dirty,
> .flush_log_dirty = vmx_flush_log_dirty,
> .enable_log_dirty_pt_masked = vmx_enable_log_dirty_pt_masked,
> + .cpu_dirty_log_size = PML_ENTITY_NUM,
>
> .pre_block = vmx_pre_block,
> .post_block = vmx_post_block,
> @@ -7785,7 +7781,6 @@ static struct kvm_x86_ops vmx_x86_ops __initdata = {
>
> .msr_filter_changed = vmx_msr_filter_changed,
> .complete_emulated_msr = kvm_complete_insn_gp,
> - .cpu_dirty_log_size = vmx_cpu_dirty_log_size,
>
> .vcpu_deliver_sipi_vector = kvm_vcpu_deliver_sipi_vector,
> };
> @@ -7907,7 +7902,7 @@ static __init int hardware_setup(void)
> vmx_x86_ops.slot_disable_log_dirty = NULL;
> vmx_x86_ops.flush_log_dirty = NULL;
> vmx_x86_ops.enable_log_dirty_pt_masked = NULL;
> - vmx_x86_ops.cpu_dirty_log_size = NULL;
> + vmx_x86_ops.cpu_dirty_log_size = 0;
> }
>
> if (!cpu_has_vmx_preemption_timer())
>
next prev parent reply other threads:[~2021-02-18 16:07 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-13 0:50 [PATCH 00/14] KVM: x86/mmu: Dirty logging fixes and improvements Sean Christopherson
2021-02-13 0:50 ` [PATCH 01/14] KVM: x86/mmu: Expand collapsible SPTE zap for TDP MMU to ZONE_DEVICE pages Sean Christopherson
2021-02-18 12:36 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 02/14] KVM: x86/mmu: Don't unnecessarily write-protect small pages in TDP MMU Sean Christopherson
2021-02-13 0:50 ` [PATCH 03/14] KVM: x86/mmu: Split out max mapping level calculation to helper Sean Christopherson
2021-02-13 0:50 ` [PATCH 04/14] KVM: x86/mmu: Pass the memslot to the rmap callbacks Sean Christopherson
2021-02-13 0:50 ` [PATCH 05/14] KVM: x86/mmu: Consult max mapping level when zapping collapsible SPTEs Sean Christopherson
2021-02-18 12:43 ` Paolo Bonzini
2021-02-18 16:23 ` Sean Christopherson
2021-02-18 22:30 ` Mike Kravetz
2021-02-19 1:31 ` Sean Christopherson
2021-02-13 0:50 ` [PATCH 06/14] KVM: nVMX: Disable PML in hardware when running L2 Sean Christopherson
2021-02-13 0:50 ` [PATCH 07/14] KVM: x86/mmu: Expand on the comment in kvm_vcpu_ad_need_write_protect() Sean Christopherson
2021-02-13 0:50 ` [PATCH 08/14] KVM: x86/mmu: Make dirty log size hook (PML) a value, not a function Sean Christopherson
2021-02-18 12:45 ` Paolo Bonzini [this message]
2021-02-13 0:50 ` [PATCH 09/14] KVM: x86: Move MMU's PML logic to common code Sean Christopherson
2021-02-13 0:50 ` [PATCH 10/14] KVM: x86: Further clarify the logic and comments for toggling log dirty Sean Christopherson
2021-02-18 12:50 ` Paolo Bonzini
2021-02-18 16:15 ` Sean Christopherson
2021-02-18 16:56 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 11/14] KVM: VMX: Dynamically enable/disable PML based on memslot dirty logging Sean Christopherson
2021-02-13 0:50 ` [PATCH 12/14] KVM: x86/mmu: Don't set dirty bits when disabling dirty logging w/ PML Sean Christopherson
2021-02-18 17:08 ` Paolo Bonzini
2021-02-13 0:50 ` [PATCH 13/14] KVM: x86: Fold "write-protect large" use case into generic write-protect Sean Christopherson
2021-02-13 0:50 ` [PATCH 14/14] KVM: x86/mmu: Remove a variety of unnecessary exports Sean Christopherson
2021-02-17 22:50 ` [PATCH 00/14] KVM: x86/mmu: Dirty logging fixes and improvements Sean Christopherson
2021-02-18 12:57 ` Paolo Bonzini
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9bb705c8-101d-5f20-bffd-ccd44cbaf663@redhat.com \
--to=pbonzini@redhat.com \
--cc=bgardon@google.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=makarandsonare@google.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox