Skip to contentSkip to conversation

x86: use -cpu max instead of -cpu host

PATCH In review Paolo Bonzini 2 participants 3 messages Jan 27, 2021 KVM

lore
Share & tools
lore

Paolo Bonzini

author maintainer
#0 lore raw

PATCH 1/1 x86: use -cpu max instead of -cpu host

This allows the tests to run under TCG as well. "-cpu max" is not available on CentOS 7, however that doesn't change much for our CI since we weren't testing the CentOS 7 + KVM combination anyway.

---
 .gitlab-ci.yml    |  4 +++-
 x86/unittests.cfg | 40 ++++++++++++++++++++--------------------
 2 files changed, 23 insertions(+), 21 deletions(-)
.gitlab-ci.yml +3 -1
index 8834e59..d97e27e 100644
@@ -75,6 +75,7 @@ build-x86_64:
      vmexit_mov_to_cr8 vmexit_inl_pmtimer  vmexit_ipi vmexit_ipi_halt
      vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed
      eventinj msr port80 setjmp sieve syscall tsc rmap_chain umip intel_iommu
+     rdpru pku pks smap tsc_adjust xsave
      | tee results.txt
  - if grep -q FAIL results.txt ; then exit 1 ; fi
 
@@ -89,7 +90,7 @@ build-i386:
      cmpxchg8b vmexit_cpuid vmexit_mov_from_cr8 vmexit_mov_to_cr8
      vmexit_inl_pmtimer vmexit_ipi vmexit_ipi_halt vmexit_ple_round_robin
      vmexit_tscdeadline vmexit_tscdeadline_immed eventinj port80 setjmp sieve
-     tsc taskswitch umip
+     tsc taskswitch umip rdpru smap tsc_adjust xsave
      | tee results.txt
  - if grep -q FAIL results.txt ; then exit 1 ; fi
 
@@ -103,6 +104,7 @@ build-clang:
      vmexit_mov_to_cr8 vmexit_inl_pmtimer  vmexit_ipi vmexit_ipi_halt
      vmexit_ple_round_robin vmexit_tscdeadline vmexit_tscdeadline_immed
      eventinj msr port80 setjmp syscall tsc rmap_chain umip intel_iommu
+     rdpru pku pks smap tsc_adjust xsave
      | tee results.txt
  - grep -q PASS results.txt && ! grep -q FAIL results.txt
 
x86/unittests.cfg +20 -20
index 8c39630..90e370f 100644
@@ -128,12 +128,12 @@ check = /sys/module/kvm_intel/parameters/allow_smaller_maxphyaddr=Y
 
 [smap]
 file = smap.flat
-extra_params = -cpu host
+extra_params = -cpu max
 
 [pku]
 file = pku.flat
 arch = x86_64
-extra_params = -cpu host
+extra_params = -cpu max
 
 [pks]
 file = pks.flat
@@ -163,7 +163,7 @@ arch = x86_64
 
 [memory]
 file = memory.flat
-extra_params = -cpu host
+extra_params = -cpu max
 arch = x86_64
 
 [msr]
@@ -171,12 +171,12 @@ file = msr.flat
 
 [pmu]
 file = pmu.flat
-extra_params = -cpu host
+extra_params = -cpu max
 check = /proc/sys/kernel/nmi_watchdog=0
 
 [vmware_backdoors]
 file = vmware_backdoors.flat
-extra_params = -machine vmport=on -cpu host
+extra_params = -machine vmport=on -cpu max
 check = /sys/module/kvm/parameters/enable_vmware_backdoor=Y
 arch = x86_64
 
@@ -204,12 +204,12 @@ extra_params = -cpu kvm64,+rdtscp
 
 [tsc_adjust]
 file = tsc_adjust.flat
-extra_params = -cpu host
+extra_params = -cpu max
 
 [xsave]
 file = xsave.flat
 arch = x86_64
-extra_params = -cpu host
+extra_params = -cpu max
 
 [rmap_chain]
 file = rmap_chain.flat
@@ -218,7 +218,7 @@ arch = x86_64
 [svm]
 file = svm.flat
 smp = 2
-extra_params = -cpu host,+svm -m 4g
+extra_params = -cpu max,+svm -m 4g
 arch = x86_64
 
 [taskswitch]
@@ -248,7 +248,7 @@ arch = x86_64
 
 [rdpru]
 file = rdpru.flat
-extra_params = -cpu host
+extra_params = -cpu max
 arch = x86_64
 
 [umip]
@@ -261,33 +261,33 @@ arch = i386
 
 [vmx]
 file = vmx.flat
-extra_params = -cpu host,+vmx -append "-exit_monitor_from_l2_test -ept_access* -vmx_smp* -vmx_vmcs_shadow_test -atomic_switch_overflow_msrs_test -vmx_init_signal_test -vmx_apic_passthrough_tpr_threshold_test"
+extra_params = -cpu max,+vmx -append "-exit_monitor_from_l2_test -ept_access* -vmx_smp* -vmx_vmcs_shadow_test -atomic_switch_overflow_msrs_test -vmx_init_signal_test -vmx_apic_passthrough_tpr_threshold_test"
 arch = x86_64
 groups = vmx
 
 [ept]
 file = vmx.flat
-extra_params = -cpu host,host-phys-bits,+vmx -m 2560 -append "ept_access*"
+extra_params = -cpu max,host-phys-bits,+vmx -m 2560 -append "ept_access*"
 arch = x86_64
 groups = vmx
 
 [vmx_eoi_bitmap_ioapic_scan]
 file = vmx.flat
 smp = 2
-extra_params = -cpu host,+vmx -m 2048 -append vmx_eoi_bitmap_ioapic_scan_test
+extra_params = -cpu max,+vmx -m 2048 -append vmx_eoi_bitmap_ioapic_scan_test
 arch = x86_64
 groups = vmx
 
 [vmx_hlt_with_rvi_test]
 file = vmx.flat
-extra_params = -cpu host,+vmx -append vmx_hlt_with_rvi_test
+extra_params = -cpu max,+vmx -append vmx_hlt_with_rvi_test
 arch = x86_64
 groups = vmx
 timeout = 10
 
 [vmx_apicv_test]
 file = vmx.flat
-extra_params = -cpu host,+vmx -append "apic_reg_virt_test virt_x2apic_mode_test"
+extra_params = -cpu max,+vmx -append "apic_reg_virt_test virt_x2apic_mode_test"
 arch = x86_64
 groups = vmx
 timeout = 10
@@ -295,14 +295,14 @@ timeout = 10
 [vmx_apic_passthrough_thread]
 file = vmx.flat
 smp = 2
-extra_params = -cpu host,+vmx -m 2048 -append vmx_apic_passthrough_thread_test
+extra_params = -cpu max,+vmx -m 2048 -append vmx_apic_passthrough_thread_test
 arch = x86_64
 groups = vmx
 
 [vmx_init_signal_test]
 file = vmx.flat
 smp = 2
-extra_params = -cpu host,+vmx -m 2048 -append vmx_init_signal_test
+extra_params = -cpu max,+vmx -m 2048 -append vmx_init_signal_test
 arch = x86_64
 groups = vmx
 timeout = 10
@@ -310,21 +310,21 @@ timeout = 10
 [vmx_sipi_signal_test]
 file = vmx.flat
 smp = 2
-extra_params = -cpu host,+vmx -m 2048 -append vmx_sipi_signal_test
+extra_params = -cpu max,+vmx -m 2048 -append vmx_sipi_signal_test
 arch = x86_64
 groups = vmx
 timeout = 10
 
 [vmx_apic_passthrough_tpr_threshold_test]
 file = vmx.flat
-extra_params = -cpu host,+vmx -m 2048 -append vmx_apic_passthrough_tpr_threshold_test
+extra_params = -cpu max,+vmx -m 2048 -append vmx_apic_passthrough_tpr_threshold_test
 arch = x86_64
 groups = vmx
 timeout = 10
 
 [vmx_vmcs_shadow_test]
 file = vmx.flat
-extra_params = -cpu host,+vmx -append vmx_vmcs_shadow_test
+extra_params = -cpu max,+vmx -append vmx_vmcs_shadow_test
 arch = x86_64
 groups = vmx
 
@@ -367,5 +367,5 @@ extra_params = -M q35,kernel-irqchip=split -device intel-iommu,intremap=on,eim=o
 
 [tsx-ctrl]
 file = tsx-ctrl.flat
-extra_params = -cpu host
+extra_params = -cpu max
 groups = tsx-ctrl
Signature · 1 line
2.29.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Paolo Bonzini

This allows the tests to run under TCG as well. "-cpu max" is not available on CentOS 7, however that doesn't change much for our CI since we weren't testing the CentOS 7 + KVM combination anyway.

"-cpu max" has been added with QEMU v2.10 ... Wasn't there the possibility to install a qemu-kvm-ev package instead of the normal qemu-kvm package on CentOS 7 ? qemu-kvm-ev should likely be new enough already, I guess?

Anyway, for this patch:

author maintainer
#2 lore raw
Quoted 6 lines · Thomas Huth
Quoted 3 lines · Paolo Bonzini

This allows the tests to run under TCG as well.  "-cpu max" is not available on CentOS 7, however that doesn't change much for our CI since we weren't testing the CentOS 7 + KVM combination anyway.

"-cpu max" has been added with QEMU v2.10 ... Wasn't there the possibility to install a qemu-kvm-ev package instead of the normal qemu-kvm package on CentOS 7 ? qemu-kvm-ev should likely be new enough already, I guess?

Yes, that would work too. I'm not sure if that version would also be able to run emulated SMAP or PKRU tests.

However, runnning on old TCG is of limited use because it's bound to encounter emulation bugs. It is of course useful to have a smoke test to ensure that we don't encounter compilation issues, of course!

Paolo