Skip to content

KVM: selftests: Clang fixes, Makefile cleanup

Sean Christopherson kvm kvmarm linux-arm-kernel linux-riscv lkml llvm 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest14 patches 14 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/14KVM: selftests: Define literal to asm constraint in aarch64 as unsigned longtools/testing/selftests/kvm/aarch64/page_fault_test.c+1 -11 reply
2/14KVM: selftests: Delete dead code in x86_64/vmx_tsc_adjust_test.ctools/testing/selftests/kvm/x86_64/vmx_tsc_adjust_test.c+0 -50 replies
3/14KVM: selftests: Fix divide-by-zero bug in memslot_perf_testtools/testing/selftests/kvm/memslot_perf_test.c+3 -01 reply
4/14KVM: selftests: Use pattern matching in .gitignoretools/testing/selftests/kvm/.gitignore+6 -850 replies
5/14KVM: selftests: Fix a typo in x86-64's kvm_get_cpu_address_width()tools/testing/selftests/kvm/lib/x86_64/processor.c+1 -11 reply
6/14KVM: selftests: Rename UNAME_M to ARCH_DIR, fill explicitly for x86tools/testing/selftests/kvm/Makefile+15 -343 replies
7/14KVM: selftests: Use proper function prototypes in probing codetools/testing/selftests/kvm/Makefile+2 -21 reply
8/14KVM: selftests: Probe -no-pie with actual CFLAGS used to compiletools/testing/selftests/kvm/Makefile+1 -10 replies
9/14KVM: selftests: Explicitly disable builtins for mem*() overridestools/testing/selftests/kvm/Makefile+1 -01 reply
10/14KVM: selftests: Include lib.mk before consuming $(CC)tools/testing/selftests/kvm/Makefile+5 -41 reply
11/14KVM: selftests: Disable "gnu-variable-sized-type-not-at-end" warningtools/testing/selftests/kvm/Makefile+1 -03 replies
12/14KVM: selftests: Use wildcards to find library source filestools/testing/selftests/kvm/Makefile+5 -402 replies
13/14KVM: selftests: Use wildcards to find targets and test source filestools/testing/selftests/kvm/Makefile tools/testing/selftests/kvm/access_tracking_perf_test.c tools/testing/selftests/kvm/dirty_log_perf_test.c +8 more+46 -1220 replies
14/14KVM: selftests: Enable RSEQ test for RISC-Vtools/testing/selftests/kvm/rseq_test.c+0 -20 replies

Reviews trailers per patch

4 of 14 patches have a Reviewed-by or Acked-by.

PatchPhilippe Mathieu-Daudé
1/14R-b
2/14
3/14R-b
4/14
5/14R-b
6/14
7/14R-b
8/14
9/14
10/14
11/14
12/14
13/14
14/14

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/14] KVM: selftests: Clang fixes, Makefile cleanup

Fix a variety of KVM selftests issues exposed by clang, and rework the Makefile and .gitignore to reduce the maintenance burden of selftests.

For the Makefile, programmatically generate the list of targets by looking for .c files, and opt-out via a dummy macro in the source instead of forcing architectures to opt-in. The opt-out approach is less error prone (harder to forget to add an arch), doesn't generate unnecessary conflicts if multiple tests are added simultanesouly, and makes it much easier to understand which tests aren't supported, e.g.

  $ git grep TEST_UNSUPPORTED | grep aarch64
  hardware_disable_test.c:TEST_UNSUPPORTED(aarch64);
  max_guest_memory_test.c:TEST_UNSUPPORTED(aarch64);
  system_counter_offset_test.c:TEST_UNSUPPORTED(aarch64);

This all started when trying to reproduce clang build errors reported by Raghu and Aaron that were introduced by commit 6b6f71484bf4 ("KVM:
selftests: Implement memcmp(), memcpy(), and memset() for guest use"). Just getting selftests to compile with clang was a nightmare, as it took me several hours to realize that "CC=clang make" and "make CC=clang" aren't equivalent, and that the "include ../lib.mak" buried halfway through the Makefile was overriding "CC=clang make".

After too many hours fighting to get clang working, my frustration with the Makefile boiled over a bit...

Note, I have fixes for the RISC-V RSEQ bugs (outside of selftests/kvm) that I'll post separately.

Tested on x86 and arm, build tested on s390x and RISC-V, all with both gcc and clang.

Sean Christopherson (14):
KVM: selftests: Define literal to asm constraint in aarch64 as
unsigned long
KVM: selftests: Delete dead code in x86_64/vmx_tsc_adjust_test.c
KVM: selftests: Fix divide-by-zero bug in memslot_perf_test
KVM: selftests: Use pattern matching in .gitignore
KVM: selftests: Fix a typo in x86-64's kvm_get_cpu_address_width()
KVM: selftests: Rename UNAME_M to ARCH_DIR, fill explicitly for x86
KVM: selftests: Use proper function prototypes in probing code
KVM: selftests: Probe -no-pie with actual CFLAGS used to compile
KVM: selftests: Explicitly disable builtins for mem*() overrides
KVM: selftests: Include lib.mk before consuming $(CC)
KVM: selftests: Disable "gnu-variable-sized-type-not-at-end" warning
KVM: selftests: Use wildcards to find library source files
KVM: selftests: Use wildcards to find targets and test source files
KVM: selftests: Enable RSEQ test for RISC-V

 tools/testing/selftests/kvm/.gitignore        |  91 +------
 tools/testing/selftests/kvm/Makefile          | 229 +++---------------
 .../selftests/kvm/aarch64/page_fault_test.c   |   2 +-
 .../selftests/kvm/access_tracking_perf_test.c |   3 +
 .../selftests/kvm/dirty_log_perf_test.c       |   3 +
 .../selftests/kvm/hardware_disable_test.c     |   4 +
 .../testing/selftests/kvm/include/test_util.h |  11 +
 .../selftests/kvm/lib/x86_64/processor.c      |   2 +-
 .../selftests/kvm/max_guest_memory_test.c     |   4 +
 .../kvm/memslot_modification_stress_test.c    |   3 +
 .../testing/selftests/kvm/memslot_perf_test.c |   6 +
 tools/testing/selftests/kvm/steal_time.c      |   3 +
 .../kvm/system_counter_offset_test.c          |   4 +
 .../kvm/x86_64/vmx_tsc_adjust_test.c          |   5 -
 14 files changed, 80 insertions(+), 290 deletions(-)

base-commit: f1a1d3aff0cc2e68a9ebbd8810d7dcd8cfe2714b

Signature · 1 line
2.39.0.rc1.256.g54fd8350bd-goog