[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YbD2q/MhBjm2OMOe@google.com>
Date: Wed, 8 Dec 2021 18:17:15 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Like Xu <like.xu.linux@...il.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Joerg Roedel <joro@...tes.org>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 5/7] KVM: x86: Move .pmu_ops to kvm_x86_init_ops and
tagged as __initdata
s/tagged/tag
On Mon, Nov 08, 2021, Like Xu wrote:
> From: Like Xu <likexu@...cent.com>
>
> The pmu_ops should be moved to kvm_x86_init_ops and tagged as __initdata.
State what the patch does, not what "should" be done.
Now that pmu_ops is copied by value during kvm_arch_hardware_setup(), move
the pointer to kvm_x86_init_ops and tag implementations as __initdata to make
the implementations unreachable once KVM is loaded, e.g. to make it harder to
sneak in post-init modification bugs.
> That'll save those precious few bytes, and more importantly make
> the original ops unreachable, i.e. make it harder to sneak in post-init
> modification bugs.
>
> Suggested-by: Sean Christopherson <seanjc@...gle.com>
> Signed-off-by: Like Xu <likexu@...cent.com>
> ---
> arch/x86/include/asm/kvm_host.h | 4 ++--
> arch/x86/kvm/svm/pmu.c | 2 +-
> arch/x86/kvm/svm/svm.c | 2 +-
> arch/x86/kvm/vmx/pmu_intel.c | 2 +-
> arch/x86/kvm/vmx/vmx.c | 2 +-
> arch/x86/kvm/x86.c | 2 +-
> 6 files changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
> index c2d4ee2973c5..00760a3ac88c 100644
> --- a/arch/x86/include/asm/kvm_host.h
> +++ b/arch/x86/include/asm/kvm_host.h
> @@ -1436,8 +1436,7 @@ struct kvm_x86_ops {
> int cpu_dirty_log_size;
> void (*update_cpu_dirty_logging)(struct kvm_vcpu *vcpu);
>
> - /* pmu operations of sub-arch */
> - const struct kvm_pmu_ops *pmu_ops;
> + /* nested operations of sub-arch */
No need for the new comment.
> const struct kvm_x86_nested_ops *nested_ops;
>
> /*
Nits aside,
Reviewed-by: Sean Christopherson <seanjc@...gle.com>
I'd also be a-ok squashing this with the copy-by-value patch.
Powered by blists - more mailing lists