mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/3] KVM: selftests: Delete three pieces of dead library code
@ 2026-09-18 11:36 Gokul K
  2026-09-18 11:36 ` [PATCH 1/3] KVM: selftests: Delete the unused sparsebit copy and count helpers Gokul K
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Gokul K @ 2026-09-18 11:36 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, kvm
  Cc: Shuah Khan, linux-kselftest, linux-kernel

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(-)

-- 
2.51.0



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-09-18 16:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 11:36 [PATCH 0/3] KVM: selftests: Delete three pieces of dead library code Gokul K
2026-09-18 11:36 ` [PATCH 1/3] KVM: selftests: Delete the unused sparsebit copy and count helpers Gokul K
2026-09-18 16:24   ` Sean Christopherson
2026-09-18 11:36 ` [PATCH 2/3] KVM: selftests: Delete the declaration of vcpu_set_cpuid_maxphyaddr() Gokul K
2026-09-18 11:36 ` [PATCH 3/3] KVM: selftests: Delete the unused guest_snprintf() Gokul K
2026-09-18 16:05   ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®