Skip to contentSkip to conversation

Update travis CI

PATCH Superseded Thomas Huth 3 participants 13 messages Sep 24, 2020 – Sep 25, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Update travis CI

Travis now features Ubuntu Focal containers, so we can update our kvm-unit-tests CI to use it for getting a newer version of QEMU and the compilers. Thanks to this QEMU update, we can now run more tests with TCG here.

Additionally, this series switches the second aarch64 build job to use the native builder - this way we can use the Clang compiler there to get some additional test coverage. This indeed already helped to discover some bogus register constraints in the aarch64 code. (ppc64 and s390x are not using the native builders yet since there are still some issues with Clang there that I haven't quite figured out ... that's maybe something for later)

Thomas Huth (9):
travis.yml: Update from Bionic to Focal travis.yml: Rework the x86 64-bit tests travis.yml: Refresh the x86 32-bit test list travis.yml: Add the selftest-setup ppc64 test
kbuild: fix asm-offset generation to work with clang arm/pmu: Fix inline assembly for Clang lib/arm64/spinlock: Fix inline assembly for Clang travis.yml: Rework the aarch64 jobs travis.yml: Update the list of s390x tests

 .travis.yml             | 71 ++++++++++++++++++++++++-----------------
 arm/pmu.c               | 10 +++---
 lib/arm64/spinlock.c    |  2 +-
 lib/kbuild.h            |  6 ++--
 scripts/asm-offsets.mak |  5 +--
 5 files changed, 54 insertions(+), 40 deletions(-)
Signature · 1 line
2.18.2
#1 lore raw

PATCH 1/9 travis.yml: Update from Bionic to Focal

The newer version of QEMU in Focal should help to run more tests with TCG (which will be enabled in later patches).

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
index 2e5ae41..3b18ce5 100644
@@ -1,4 +1,4 @@
-dist: bionic
+dist: focal
 language: c
 cache: ccache
 git:
Signature · 1 line
2.18.2
#2 lore raw

PATCH 2/9 travis.yml: Rework the x86 64-bit tests

In reply to Thomas Huth

We currently have three test jobs here:

1) gcc, in-tree build
2) gcc, out-of-tree build
3) clang, in-tree build

Keeping everything in perspective, it should be sufficient to only use two build jobs for this, one in-tree with one compiler, and one out-of-tree with the other compiler.
So let's re-order the jobs accordingly now. And while we're at it, make sure that all additional tests that work with the newer QEMU from Ubuntu Focal now are tested, too, and that we check all possible tests with Clang (i.e. the same list as with GCC except for the "realmode" test that still causes some problems with Clang).

---
 .travis.yml | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)
.travis.yml +17 -17
index 3b18ce5..4c35509 100644
@@ -12,30 +12,30 @@ jobs:
       env:
       - CONFIG=""
       - BUILD_DIR="."
-      - TESTS="access asyncpf debug emulator ept hypercall hyperv_stimer
-               hyperv_synic idt_test intel_iommu ioapic ioapic-split
-               kvmclock_test msr pcid rdpru realmode rmap_chain s3 setjmp umip"
+      - TESTS="access asyncpf debug emulator ept hypercall hyperv_clock
+          hyperv_connections hyperv_stimer hyperv_synic idt_test intel_iommu
+          ioapic ioapic-split kvmclock_test memory msr pcid pcid-disabled
+          rdpru realmode rmap_chain s3 setjmp sieve smap smptest smptest3
+          syscall tsc tsc_adjust tsx-ctrl umip vmexit_cpuid vmexit_inl_pmtimer
+          vmexit_ipi vmexit_ipi_halt vmexit_mov_from_cr8 vmexit_mov_to_cr8
+          vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed
+          vmexit_vmcall vmx_apic_passthrough_thread xsave"
       - ACCEL="kvm"
 
     - addons:
         apt_packages: clang-10 qemu-system-x86
+      compiler: clang
       env:
       - CONFIG="--cc=clang-10"
-      - BUILD_DIR="."
-      - TESTS="access asyncpf debug emulator ept hypercall hyperv_stimer
-               hyperv_synic idt_test intel_iommu ioapic ioapic-split
-               kvmclock_test msr pcid rdpru rmap_chain s3 setjmp umip"
-      - ACCEL="kvm"
-
-    - addons:
-        apt_packages: gcc qemu-system-x86
-      env:
-      - CONFIG=""
       - BUILD_DIR="x86-builddir"
-      - TESTS="smptest smptest3 tsc tsc_adjust xsave vmexit_cpuid vmexit_vmcall
-               sieve vmexit_inl_pmtimer vmexit_ipi_halt vmexit_mov_from_cr8
-               vmexit_mov_to_cr8 vmexit_ple_round_robin vmexit_tscdeadline
-               vmexit_tscdeadline_immed  vmx_apic_passthrough_thread syscall"
+      - TESTS="access asyncpf debug emulator ept hypercall hyperv_clock
+          hyperv_connections hyperv_stimer hyperv_synic idt_test intel_iommu
+          ioapic ioapic-split kvmclock_test memory msr pcid pcid-disabled
+          rdpru rmap_chain s3 setjmp sieve smap smptest smptest3 syscall tsc
+          tsc_adjust tsx-ctrl umip vmexit_cpuid vmexit_inl_pmtimer vmexit_ipi
+          vmexit_ipi_halt vmexit_mov_from_cr8 vmexit_mov_to_cr8
+          vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed
+          vmexit_vmcall vmx_apic_passthrough_thread xsave"
       - ACCEL="kvm"
 
     - addons:
Signature · 1 line
2.18.2
#3 lore raw

Re: [kvm-unit-tests PATCH 2/9] travis.yml: Rework the x86 64-bit tests

Quoted 6 lines · Thomas Huth

We currently have three test jobs here:

1) gcc, in-tree build
2) gcc, out-of-tree build
3) clang, in-tree build

Quoted 8 lines

Keeping everything in perspective, it should be sufficient to only use two build jobs for this, one in-tree with one compiler, and one out-of-tree with the other compiler.
So let's re-order the jobs accordingly now. And while we're at it, make sure that all additional tests that work with the newer QEMU from Ubuntu Focal now are tested, too, and that we check all possible tests with Clang (i.e. the same list as with GCC except for the "realmode" test that still causes some problems with Clang).

This patch needs a rebase now since the realmode test has just been fixed and added to .travis.yml ... I'll wait one or two more days for review feedback, then respin a v2 with the conflict solved.

Thomas

#4 lore raw

PATCH 3/9 travis.yml: Refresh the x86 32-bit test list

In reply to Thomas Huth

With the new QEMU from Ubuntu Focal, we can now run additional tests that were failing before.

---
 .travis.yml | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
.travis.yml +6 -4
index 4c35509..01951dc 100644
@@ -43,8 +43,9 @@ jobs:
       env:
       - CONFIG="--arch=i386"
       - BUILD_DIR="."
-      - TESTS="asyncpf hyperv_stimer hyperv_synic kvmclock_test msr pmu realmode
-               s3 sieve smap smptest smptest3 taskswitch taskswitch2 tsc_adjust"
+      - TESTS="asyncpf hyperv_connections hyperv_stimer hyperv_synic
+          kvmclock_test msr pmu realmode s3 setjmp sieve smap smptest smptest3
+          taskswitch taskswitch2 tsc tsc_adjust"
       - ACCEL="kvm"
 
     - addons:
@@ -53,8 +54,9 @@ jobs:
       - CONFIG="--arch=i386"
       - BUILD_DIR="i386-builddir"
       - TESTS="cmpxchg8b tsx-ctrl umip vmexit_cpuid vmexit_ipi vmexit_ipi_halt
-               vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ple_round_robin
-               vmexit_tscdeadline vmexit_tscdeadline_immed vmexit_vmcall setjmp"
+          vmexit_mov_from_cr8 vmexit_mov_to_cr8 vmexit_ple_round_robin
+          vmexit_inl_pmtimer vmexit_tscdeadline vmexit_tscdeadline_immed
+          vmexit_vmcall"
       - ACCEL="kvm"
 
     - addons:
Signature · 1 line
2.18.2
#5 lore raw

PATCH 4/9 travis.yml: Add the selftest-setup ppc64 test

In reply to Thomas Huth

This test now seems to be working with the newer version of QEMU in Ubuntu Focal, so we can run it now in the Travis builds, too.

---
 .travis.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
.travis.yml +1 -1
index 01951dc..7e96faa 100644
@@ -92,7 +92,7 @@ jobs:
       env:
       - CONFIG="--arch=ppc64 --endian=little --cross-prefix=powerpc64le-linux-gnu-"
       - BUILD_DIR="."
-      - TESTS="spapr_hcall emulator rtas-set-time-of-day"
+      - TESTS="selftest-setup spapr_hcall emulator rtas-set-time-of-day"
       - ACCEL="tcg,cap-htm=off"
 
     - addons:
Signature · 1 line
2.18.2
#6 lore raw

PATCH 5/9 kbuild: fix asm-offset generation to work with clang

In reply to Thomas Huth

KBuild abuses the asm statement to write to a file and clang chokes about these invalid asm statements. Hack it even more by fooling this is actual valid asm code.

This is an adaption of the Linux kernel commit cf0c3e68aa81f992b0 which in turn is based on a patch for the U-Boot:
http://patchwork.ozlabs.org/patch/375026/

---
 lib/kbuild.h            | 6 +++---
 scripts/asm-offsets.mak | 5 +++--
 2 files changed, 6 insertions(+), 5 deletions(-)
lib/kbuild.h +3 -3
index ab99db6..79644e5 100644
@@ -1,8 +1,8 @@
 #ifndef _KBUILD_H_
 #define _KBUILD_H_
 #define DEFINE(sym, val) \
-	asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+	asm volatile("\n.ascii \"->" #sym " %0 " #val "\"" : : "i" (val))
 #define OFFSET(sym, str, mem)	DEFINE(sym, offsetof(struct str, mem))
-#define COMMENT(x)		asm volatile("\n->#" x)
-#define BLANK()			asm volatile("\n->" : : )
+#define COMMENT(x)		asm volatile("\n.ascii \"->#" x "\"")
+#define BLANK()			asm volatile("\n.ascii \"->\"" : : )
 #endif
scripts/asm-offsets.mak +3 -2
index b35da09..7b64162 100644
@@ -8,10 +8,11 @@
 #
 
 define sed-y
-	"/^->/{s:->#\(.*\):/* \1 */:; \
+	's:^[[:space:]]*\.ascii[[:space:]]*"\(.*\)".*:\1:; \
+	/^->/{s:->#\(.*\):/* \1 */:; \
 	s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
 	s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-	s:->::; p;}"
+	s:->::; p;}'
 endef
 
 define make_asm_offsets
Signature · 1 line
2.18.2
#7 lore raw

PATCH 6/9 arm/pmu: Fix inline assembly for Clang

In reply to Thomas Huth

Clang complains here:

arm/pmu.c:201:16: error: value size does not match register size specified by
the constraint and modifier [-Werror,-Wasm-operand-widths]

        : [pmcr] "r" (pmcr)
                      ^
arm/pmu.c:194:18: note: use constraint modifier "w"
        "       msr     pmcr_el0, %[pmcr]\n"
                                  ^~~~~~~
                                  %w[pmcr]
arm/pmu.c:200:17: error: value size does not match register size specified by
 the constraint and modifier [-Werror,-Wasm-operand-widths]
        : [loop] "+r" (loop)
                       ^
arm/pmu.c:196:11: note: use constraint modifier "w"
        "1:     subs    %[loop], %[loop], #1\n"
                        ^~~~~~~
                        %w[loop]
arm/pmu.c:200:17: error: value size does not match register size specified by
 the constraint and modifier [-Werror,-Wasm-operand-widths]
        : [loop] "+r" (loop)
                       ^
arm/pmu.c:196:20: note: use constraint modifier "w"
        "1:     subs    %[loop], %[loop], #1\n"
                                 ^~~~~~~
                                 %w[loop]
arm/pmu.c:284:35: error: value size does not match register size specified
 by the constraint and modifier [-Werror,-Wasm-operand-widths]
        : [addr] "r" (addr), [pmcr] "r" (pmcr), [loop] "r" (loop)
                                         ^
arm/pmu.c:274:28: note: use constraint modifier "w"
        "       msr     pmcr_el0, %[pmcr]\n"
                                  ^~~~~~~
                                  %w[pmcr]
arm/pmu.c:284:54: error: value size does not match register size specified
 by the constraint and modifier [-Werror,-Wasm-operand-widths]
        : [addr] "r" (addr), [pmcr] "r" (pmcr), [loop] "r" (loop)
                                                            ^
arm/pmu.c:276:23: note: use constraint modifier "w"
        "       mov     x10, %[loop]\n"
                             ^~~~~~~
                             %w[loop]

pmcr should be 64-bit since it is a sysreg, but for loop we can use the "w" modifier.

---
 arm/pmu.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arm/pmu.c +6 -4
index cece53e..831fb66 100644
@@ -190,15 +190,16 @@ static inline uint8_t get_pmu_version(void)
  */
 static inline void precise_instrs_loop(int loop, uint32_t pmcr)
 {
+	uint64_t pmcr64 = pmcr;
 	asm volatile(
 	"	msr	pmcr_el0, %[pmcr]\n"
 	"	isb\n"
-	"1:	subs	%[loop], %[loop], #1\n"
+	"1:	subs	%w[loop], %w[loop], #1\n"
 	"	b.gt	1b\n"
 	"	msr	pmcr_el0, xzr\n"
 	"	isb\n"
 	: [loop] "+r" (loop)
-	: [pmcr] "r" (pmcr)
+	: [pmcr] "r" (pmcr64)
 	: "cc");
 }
 
@@ -268,8 +269,9 @@ static void test_event_introspection(void)
  * pmccntr read after this function returns the exact instructions executed
  * in the controlled block. Loads @loop times the data at @address into x9.
  */
-static void mem_access_loop(void *addr, int loop, uint32_t pmcr)
+static void mem_access_loop(void *addr, long loop, uint32_t pmcr)
 {
+	uint64_t pmcr64 = pmcr;
 asm volatile(
 	"       msr     pmcr_el0, %[pmcr]\n"
 	"       isb\n"
@@ -281,7 +283,7 @@ asm volatile(
 	"       msr     pmcr_el0, xzr\n"
 	"       isb\n"
 	:
-	: [addr] "r" (addr), [pmcr] "r" (pmcr), [loop] "r" (loop)
+	: [addr] "r" (addr), [pmcr] "r" (pmcr64), [loop] "r" (loop)
 	: "x9", "x10", "cc");
 }
 
Signature · 1 line
2.18.2
#8 lore raw

PATCH 7/9 lib/arm64/spinlock: Fix inline assembly for Clang

In reply to Thomas Huth

/home/travis/build/huth/kvm-unit-tests/lib/arm64/spinlock.c:29:12: error:
value size does not match register size specified by the constraint and modifier [-Werror,-Wasm-operand-widths]

                : "=&r" (val), "=&r" (fail)
                         ^
/home/travis/build/huth/kvm-unit-tests/lib/arm64/spinlock.c:27:9: note: use
 constraint modifier "w"
                "       mov     %0, #1\n"
                                ^~
                                %w0

Use the "w" modifier as suggested to fix the issue.

---
 lib/arm64/spinlock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/arm64/spinlock.c +1 -1
index fac4fc9..258303d 100644
@@ -24,7 +24,7 @@ void spin_lock(struct spinlock *lock)
 		asm volatile(
 		"1:	ldaxr	%w0, [%2]\n"
 		"	cbnz	%w0, 1b\n"
-		"	mov	%0, #1\n"
+		"	mov	%w0, #1\n"
 		"	stxr	%w1, %w0, [%2]\n"
 		: "=&r" (val), "=&r" (fail)
 		: "r" (&lock->v)
Signature · 1 line
2.18.2
#9 lore raw

PATCH 8/9 travis.yml: Rework the aarch64 jobs

In reply to Thomas Huth

With the new QEMU from Ubuntu Focal, we can now run some more tests with TCG. Also switch the second build job to native arm64, so we can use Clang to compile these tests to get some additional compiler test coverage.

---
 .travis.yml | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
.travis.yml +13 -5
index 7e96faa..f1bcf3d 100644
@@ -78,14 +78,22 @@ jobs:
       env:
       - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
       - BUILD_DIR="."
-      - TESTS="selftest-vectors-kernel selftest-vectors-user selftest-smp"
+      - TESTS="cache gicv2-active gicv2-ipi gicv3-active gicv3-ipi pci-test
+          pmu-cycle-counter pmu-event-counter-config pmu-sw-incr psci
+          selftest-setup selftest-smp selftest-vectors-kernel
+          selftest-vectors-user timer"
 
-    - addons:
-        apt_packages: gcc-aarch64-linux-gnu qemu-system-aarch64
+    - arch: arm64
+      addons:
+        apt_packages: clang-10 qemu-system-aarch64
+      compiler: clang
       env:
-      - CONFIG="--arch=arm64 --cross-prefix=aarch64-linux-gnu-"
+      - CONFIG="--arch=arm64 --cc=clang-10"
       - BUILD_DIR="arm64-buildir"
-      - TESTS="pci-test pmu gicv2-active gicv3-active psci timer selftest-setup"
+      - TESTS="cache gicv2-active gicv2-ipi gicv3-active gicv3-ipi pci-test
+          pmu-cycle-counter pmu-event-counter-config pmu-sw-incr psci
+          selftest-setup selftest-smp selftest-vectors-kernel
+          selftest-vectors-user timer"
 
     - addons:
         apt_packages: gcc-powerpc64le-linux-gnu qemu-system-ppc
Signature · 1 line
2.18.2
#10 lore raw

PATCH 9/9 travis.yml: Update the list of s390x tests

In reply to Thomas Huth

With the new QEMU from Ubuntu Focal, we can now run more tests with TCG.

---
 .travis.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
.travis.yml +3 -2
index f1bcf3d..6080326 100644
@@ -116,7 +116,8 @@ jobs:
       env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="."
-      - TESTS="diag10 diag308"
+      - TESTS="cpumodel css diag10 diag288 diag308 emulator intercept sclp-1g
+          sclp-3g selftest-setup"
       - ACCEL="tcg,firmware=s390x/run"
 
     - addons:
@@ -124,7 +125,7 @@ jobs:
       env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="s390x-builddir"
-      - TESTS="sieve"
+      - TESTS="sieve skey stsi vector"
       - ACCEL="tcg,firmware=s390x/run"
 
     - os: osx
Signature · 1 line
2.18.2
Acked-by on v1 9/9
#11 lore raw

Re: [kvm-unit-tests PATCH 9/9] travis.yml: Update the list of s390x tests

Quoted 22 lines · On Thu, 24 Sep 2020 18:16:12 +0200 Thomas Huth <[email protected]> wrote:

With the new QEMU from Ubuntu Focal, we can now run more tests with TCG.

---
 .travis.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
.travis.yml +2 -1
index f1bcf3d..6080326 100644
@@ -116,7 +116,8 @@ jobs:
       env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="."
-      - TESTS="diag10 diag308"
+      - TESTS="cpumodel css diag10 diag288 diag308 emulator intercept sclp-1g
+          sclp-3g selftest-setup"
       - ACCEL="tcg,firmware=s390x/run"
 
     - addons:

.travis.yml jobs: · line 131

Quoted 8 lines
.travis.yml +1 -1
@@ -124,7 +125,7 @@ jobs:
       env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="s390x-builddir"
-      - TESTS="sieve"
+      - TESTS="sieve skey stsi vector"
       - ACCEL="tcg,firmware=s390x/run"
 
     - os: osx

Nice.

#12 lore raw

Re: [kvm-unit-tests PATCH 9/9] travis.yml: Update the list of s390x tests

Quoted 32 lines · Cornelia Huck
Quoted 29 lines · On Thu, 24 Sep 2020 18:16:12 +0200 Thomas Huth <[email protected]> wrote:

With the new QEMU from Ubuntu Focal, we can now run more tests with TCG.

---
 .travis.yml | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
.travis.yml +3 -2
index f1bcf3d..6080326 100644
@@ -116,7 +116,8 @@ jobs:
       env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="."
-      - TESTS="diag10 diag308"
+      - TESTS="cpumodel css diag10 diag288 diag308 emulator intercept sclp-1g
+          sclp-3g selftest-setup"
       - ACCEL="tcg,firmware=s390x/run"
 
     - addons:
@@ -124,7 +125,7 @@ jobs:
       env:
       - CONFIG="--arch=s390x --cross-prefix=s390x-linux-gnu-"
       - BUILD_DIR="s390x-builddir"
-      - TESTS="sieve"
+      - TESTS="sieve skey stsi vector"
       - ACCEL="tcg,firmware=s390x/run"
 
Quoted 6 lines

.travis.yml jobs: · line 131

Quoted 1 line
.travis.yml +0 -0
     - os: osx

Nice.

Indeed

Signature · 3 lines
Thanks,

David / dhildenb