Re: [PATCH v2 01/13] KVM: x86/mmu: Re-add const qualifier in kvm_tdp_mmu_zap_collapsible_sptes

Sean Christopherson
2021-05-26T21:25:23Z

On Thu, Apr 01, 2021, Ben Gardon wrote:
> kvm_tdp_mmu_zap_collapsible_sptes unnecessarily removes the const
> qualifier from its memlsot argument, leading to a compiler warning. Add
> the const annotation and pass it to subsequent functions.
>
> Signed-off-by: Ben Gardon <bgardon@google.com>
> ---
> arch/x86/kvm/mmu/mmu.c | 10 +++++-----
> arch/x86/kvm/mmu/mmu_internal.h | 5 +++--
> arch/x86/kvm/mmu/tdp_mmu.c | 5 +++--
> arch/x86/kvm/mmu/tdp_mmu.h | 3 ++-
> include/linux/kvm_host.h | 2 +-
> 5 files changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/arch/x86/kvm/mmu/mmu.c b/arch/x86/kvm/mmu/mmu.c
> index efb41f31e80a..617809529987 100644
> --- a/arch/x86/kvm/mmu/mmu.c
> +++ b/arch/x86/kvm/mmu/mmu.c
> @@ -715,8 +715,7 @@ static void kvm_mmu_page_set_gfn(struct kvm_mmu_page *sp, int index, gfn_t gfn)
> * handling slots that are not large page aligned.
> */
> static struct kvm_lpage_info *lpage_info_slot(gfn_t gfn,
> - struct kvm_memory_slot *slot,
> - int level)
> + const struct kvm_memory_slot *slot, int level)

I'd prefer to let this poke out (it's only 2 chars) instead of having an unaligned
param list. And if we want to make it pretty, we could always do:

static struct kvm_lpage_info *lpage_info_slot(const struct kvm_memory_slot *slot,
gfn_t gfn, int level)