From: Gokul K <gokul02k@gmail.com>
To: Sean Christopherson <seanjc@google.com>,
Paolo Bonzini <pbonzini@redhat.com>,
kvm@vger.kernel.org
Cc: Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 0/3] KVM: selftests: Delete three pieces of dead library code
Date: Fri, 18 Sep 2026 17:06:28 +0530 [thread overview]
Message-ID: <20260918113631.634233-1-gokul02k@gmail.com> (raw)
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
next reply other threads:[~2026-09-18 11:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 11:36 Gokul K [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260918113631.634233-1-gokul02k@gmail.com \
--to=gokul02k@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=shuah@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®