[PATCH 00/19] KVM: x86: Bulk removal of unused function parameters

Jinrong Liang posted 19 patches 4 years, 5 months ago
arch/x86/include/asm/kvm_host.h |  2 +-
arch/x86/kvm/emulate.c          | 20 ++++++++------------
arch/x86/kvm/i8259.c            |  8 ++++----
arch/x86/kvm/ioapic.c           |  6 ++----
arch/x86/kvm/mmu/mmu.c          | 23 ++++++++++-------------
arch/x86/kvm/mmu/mmu_audit.c    |  4 ++--
arch/x86/kvm/mmu/tdp_mmu.c      |  4 ++--
arch/x86/kvm/mmu/tdp_mmu.h      |  3 +--
arch/x86/kvm/svm/nested.c       |  4 ++--
arch/x86/kvm/svm/sev.c          | 12 ++++++------
arch/x86/kvm/svm/svm.c          | 10 +++++-----
arch/x86/kvm/svm/svm.h          |  4 ++--
arch/x86/kvm/vmx/vmx.c          |  2 +-
arch/x86/kvm/x86.c              | 25 ++++++++++++-------------
arch/x86/kvm/x86.h              |  2 +-
virt/kvm/kvm_main.c             |  9 ++++-----
16 files changed, 63 insertions(+), 75 deletions(-)
[PATCH 00/19] KVM: x86: Bulk removal of unused function parameters
Posted by Jinrong Liang 4 years, 5 months ago
From: Like Xu <likexu@tencent.com>

Hi,

This patch set is a follow up to a similar patch [1], and may
hopefully help to improve the code quality of KVM.

Basically, the cleanup is triggered by a compiler feature[2], but obviously
there are a lot of false positives here, and so far we may apply at least
this changset, which also helps the related developers to think more
carefully about why these functions were declared that way in the first
place or what is left after a series of loosely-coupled clean-ups.

[1] https://lore.kernel.org/kvm/20220124020456.156386-1-xianting.tian@linux.alibaba.com/
[2] ccflags-y += -Wunused-parameter

Thanks,
Like Xu

Jinrong Liang (19):
  KVM: x86/mmu: Remove unused "kvm" of kvm_mmu_unlink_parents()
  KVM: x86/mmu: Remove unused "kvm" of __rmap_write_protect()
  KVM: x86/mmu: Remove unused "vcpu" of
    reset_{tdp,ept}_shadow_zero_bits_mask()
  KVM: x86/tdp_mmu: Remove unused "kvm" of kvm_tdp_mmu_get_root()
  KVM: x86/mmu_audit: Remove unused "level" of audit_spte_after_sync()
  KVM: x86/svm: Remove unused "vcpu" of svm_check_exit_valid()
  KVM: x86/svm: Remove unused "vcpu" of nested_svm_check_tlb_ctl()
  KVM: x86/svm: Remove unused "vcpu" of kvm_after_interrupt()
  KVM: x86/sev: Remove unused "svm" of sev_es_prepare_guest_switch()
  KVM: x86/sev: Remove unused "kvm" of sev_unbind_asid()
  KVM: x86/sev: Remove unused "vector" of sev_vcpu_deliver_sipi_vector()
  KVM: x86/i8259: Remove unused "addr" of elcr_ioport_{read,write}()
  KVM: x86/ioapic: Remove unused "addr" and "length" of
    ioapic_read_indirect()
  KVM: x86/emulate: Remove unused "ctxt" of setup_syscalls_segments()
  KVM: x86/emulate: Remove unused "ctxt" of task_switch_{16, 32}()
  KVM: x86: Remove unused "vcpu" of kvm_arch_tsc_has_attr()
  KVM: x86: Remove unused "vcpu" of kvm_scale_tsc()
  KVM: Remove unused "kvm" of kvm_make_vcpu_request()
  KVM: Remove unused "flags" of kvm_pv_kick_cpu_op()

 arch/x86/include/asm/kvm_host.h |  2 +-
 arch/x86/kvm/emulate.c          | 20 ++++++++------------
 arch/x86/kvm/i8259.c            |  8 ++++----
 arch/x86/kvm/ioapic.c           |  6 ++----
 arch/x86/kvm/mmu/mmu.c          | 23 ++++++++++-------------
 arch/x86/kvm/mmu/mmu_audit.c    |  4 ++--
 arch/x86/kvm/mmu/tdp_mmu.c      |  4 ++--
 arch/x86/kvm/mmu/tdp_mmu.h      |  3 +--
 arch/x86/kvm/svm/nested.c       |  4 ++--
 arch/x86/kvm/svm/sev.c          | 12 ++++++------
 arch/x86/kvm/svm/svm.c          | 10 +++++-----
 arch/x86/kvm/svm/svm.h          |  4 ++--
 arch/x86/kvm/vmx/vmx.c          |  2 +-
 arch/x86/kvm/x86.c              | 25 ++++++++++++-------------
 arch/x86/kvm/x86.h              |  2 +-
 virt/kvm/kvm_main.c             |  9 ++++-----
 16 files changed, 63 insertions(+), 75 deletions(-)

-- 
2.33.1

Re: [PATCH 00/19] KVM: x86: Bulk removal of unused function parameters
Posted by Paolo Bonzini 4 years, 5 months ago
On 1/25/22 10:58, Jinrong Liang wrote:
> From: Like Xu <likexu@tencent.com>
> 
> Hi,
> 
> This patch set is a follow up to a similar patch [1], and may
> hopefully help to improve the code quality of KVM.
> 
> Basically, the cleanup is triggered by a compiler feature[2], but obviously
> there are a lot of false positives here, and so far we may apply at least
> this changset, which also helps the related developers to think more
> carefully about why these functions were declared that way in the first
> place or what is left after a series of loosely-coupled clean-ups.
> 
> [1] https://lore.kernel.org/kvm/20220124020456.156386-1-xianting.tian@linux.alibaba.com/
> [2] ccflags-y += -Wunused-parameter
> 
> Thanks,
> Like Xu
> 
> Jinrong Liang (19):
>    KVM: x86/mmu: Remove unused "kvm" of kvm_mmu_unlink_parents()
>    KVM: x86/mmu: Remove unused "kvm" of __rmap_write_protect()
>    KVM: x86/mmu: Remove unused "vcpu" of
>      reset_{tdp,ept}_shadow_zero_bits_mask()
>    KVM: x86/tdp_mmu: Remove unused "kvm" of kvm_tdp_mmu_get_root()
>    KVM: x86/mmu_audit: Remove unused "level" of audit_spte_after_sync()
>    KVM: x86/svm: Remove unused "vcpu" of svm_check_exit_valid()
>    KVM: x86/svm: Remove unused "vcpu" of nested_svm_check_tlb_ctl()
>    KVM: x86/svm: Remove unused "vcpu" of kvm_after_interrupt()
>    KVM: x86/sev: Remove unused "svm" of sev_es_prepare_guest_switch()
>    KVM: x86/sev: Remove unused "kvm" of sev_unbind_asid()
>    KVM: x86/sev: Remove unused "vector" of sev_vcpu_deliver_sipi_vector()
>    KVM: x86/i8259: Remove unused "addr" of elcr_ioport_{read,write}()
>    KVM: x86/ioapic: Remove unused "addr" and "length" of
>      ioapic_read_indirect()
>    KVM: x86/emulate: Remove unused "ctxt" of setup_syscalls_segments()
>    KVM: x86/emulate: Remove unused "ctxt" of task_switch_{16, 32}()
>    KVM: x86: Remove unused "vcpu" of kvm_arch_tsc_has_attr()
>    KVM: x86: Remove unused "vcpu" of kvm_scale_tsc()
>    KVM: Remove unused "kvm" of kvm_make_vcpu_request()
>    KVM: Remove unused "flags" of kvm_pv_kick_cpu_op()
> 
>   arch/x86/include/asm/kvm_host.h |  2 +-
>   arch/x86/kvm/emulate.c          | 20 ++++++++------------
>   arch/x86/kvm/i8259.c            |  8 ++++----
>   arch/x86/kvm/ioapic.c           |  6 ++----
>   arch/x86/kvm/mmu/mmu.c          | 23 ++++++++++-------------
>   arch/x86/kvm/mmu/mmu_audit.c    |  4 ++--
>   arch/x86/kvm/mmu/tdp_mmu.c      |  4 ++--
>   arch/x86/kvm/mmu/tdp_mmu.h      |  3 +--
>   arch/x86/kvm/svm/nested.c       |  4 ++--
>   arch/x86/kvm/svm/sev.c          | 12 ++++++------
>   arch/x86/kvm/svm/svm.c          | 10 +++++-----
>   arch/x86/kvm/svm/svm.h          |  4 ++--
>   arch/x86/kvm/vmx/vmx.c          |  2 +-
>   arch/x86/kvm/x86.c              | 25 ++++++++++++-------------
>   arch/x86/kvm/x86.h              |  2 +-
>   virt/kvm/kvm_main.c             |  9 ++++-----
>   16 files changed, 63 insertions(+), 75 deletions(-)
> 

Queued the patches I didn't comment on, thanks.

Paolo