Skip to content

KVM: selftests: Delete three pieces of dead library code

Gokul K kvm linux-kselftest lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3KVM: selftests: Delete the unused sparsebit copy and count helperstools/testing/selftests/kvm/include/sparsebit.h tools/testing/selftests/kvm/lib/sparsebit.c+1 -641 reply
2/3KVM: selftests: Delete the declaration of vcpu_set_cpuid_maxphyaddr()tools/testing/selftests/kvm/include/x86/processor.h+0 -10 replies
3/3KVM: selftests: Delete the unused guest_snprintf()tools/testing/selftests/kvm/include/test_util.h tools/testing/selftests/kvm/lib/guest_sprintf.c+0 -131 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] KVM: selftests: Delete three pieces of dead library code

Three unused things in the selftest library, found by asking the linker rather than by reading: build the selftests, then look for global symbols in lib/ that no object refers to, and check each survivor against the whole source tree by hand.

1/3 sparsebit_copy() and sparsebit_num_set(), neither called 2/3 the declaration of vcpu_set_cpuid_maxphyaddr(), which has no
definition anywhere
3/3 guest_snprintf(), a varargs wrapper nobody calls

Each is independent and they can be taken in any order.

A note on what is deliberately *not* here, because the same scan turns it up and the obvious next step is wrong. sparsebit.c still exports nine more functions that no caller outside the file uses - sparsebit_all_set(), sparsebit_is_clear(), sparsebit_validate_internal() and friends. They are not dead: they are called from inside sparsebit.c, mostly from the assertions in sparsebit_validate_internal() and from asserts in live functions, so deleting them would not build. Making them static and dropping their declarations is a defensible follow-up, but it is a change of intent about what the library exposes rather than a removal of dead code, so it does not belong in this series.

No functional change intended. Built with and without -Wextra, and a sample of twelve x86 selftests gives identical results before and after; kvm_binary_stats_test and the rest still pass. The two that fail here fail identically without the series, because this host's kernel is older than the tree.

Gokul K (3):
KVM: selftests: Delete the unused sparsebit copy and count helpers
KVM: selftests: Delete the declaration of vcpu_set_cpuid_maxphyaddr()
KVM: selftests: Delete the unused guest_snprintf()

 tools/testing/selftests/kvm/include/sparsebit.h    |  2 -
 tools/testing/selftests/kvm/include/test_util.h    |  1 -
 .../testing/selftests/kvm/include/x86/processor.h  |  1 -
 tools/testing/selftests/kvm/lib/guest_sprintf.c    | 12 -----
 tools/testing/selftests/kvm/lib/sparsebit.c        | 63 +---------------------
 5 files changed, 1 insertion(+), 78 deletions(-)
Signature · 1 line
2.51.0