Skip to contentSkip to conversation

runtime: x86: Require vPMU for x86/pmu tests

PATCH In review Sean Christopherson 1 participant 4 messages Jun 7, 2023 KVM

lore
Share & tools
lore

Sean Christopherson

author reviewer
#0 lore raw

cover runtime: x86: Require vPMU for x86/pmu tests

Fix a bug in runtime.bash that makes it not play nice with testcases that have multiple dependencies, and make x86's PMU tests depend on KVM enabling a vPMU.

Sean Christopherson (2):
runtime: Convert "check" from string to array so that iterating works x86/pmu: Make PMU testcases dependent on vPMU being enabled in KVM

 scripts/runtime.bash | 1 +
 x86/unittests.cfg    | 7 +++----
 2 files changed, 4 insertions(+), 4 deletions(-)

base-commit: 02d8befe99f8205d4caea402d8b0800354255681

Signature · 1 line
2.41.0.162.gfafddb0af9-goog
author reviewer
#1 lore raw

PATCH 1/2 runtime: Convert "check" from string to array so that iterating works

Convert "check" from a string to an array so that splitting on whitespace for iteration works as expected, i.e. so that testcases can have multiple requirements.

---
 scripts/runtime.bash | 1 +
 1 file changed, 1 insertion(+)
scripts/runtime.bash +1 -0
index 07b62b0e..1cfc5bfd 100644
@@ -120,6 +120,7 @@ function run()
     # the check line can contain multiple files to check separated by a space
     # but each check parameter needs to be of the form <path>=<value>
     if [ "$check" ]; then
+        check=($check)
         for check_param in "${check[@]}"; do
             path=${check_param%%=*}
             value=${check_param#*=}
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
author reviewer
#2 lore raw

PATCH 2/2 x86/pmu: Make PMU testcases dependent on vPMU being enabled in KVM

In reply to Sean Christopherson

Make the PMU testcases dependent on KVM actually enabling a vPMU.

Opportunistically fix the pmu_lbrs testcase to separate requirements by whitespace, not by adding additional "check" entries.

---
 x86/unittests.cfg | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
x86/unittests.cfg +3 -4
index f4e7b254..3fe59449 100644
@@ -206,7 +206,7 @@ extra_params = -cpu max,vendor=GenuineIntel
 [pmu]
 file = pmu.flat
 extra_params = -cpu max
-check = /proc/sys/kernel/nmi_watchdog=0
+check = /sys/module/kvm/parameters/enable_pmu=Y /proc/sys/kernel/nmi_watchdog=0
 accel = kvm
 groups = pmu
 
@@ -214,8 +214,7 @@ groups = pmu
 arch = x86_64
 file = pmu_lbr.flat
 extra_params = -cpu host,migratable=no
-check = /sys/module/kvm/parameters/ignore_msrs=N
-check = /proc/sys/kernel/nmi_watchdog=0
+check = /sys/module/kvm/parameters/enable_pmu=Y /proc/sys/kernel/nmi_watchdog=0 /sys/module/kvm/parameters/ignore_msrs=N
 accel = kvm
 groups = pmu
 
@@ -223,7 +222,7 @@ groups = pmu
 arch = x86_64
 file = pmu_pebs.flat
 extra_params = -cpu host,migratable=no
-check = /proc/sys/kernel/nmi_watchdog=0
+check = /sys/module/kvm/parameters/enable_pmu=Y /proc/sys/kernel/nmi_watchdog=0
 accel = kvm
 groups = pmu
 
Signature · 1 line
2.41.0.162.gfafddb0af9-goog
author reviewer
#3 lore raw
In reply to Sean Christopherson
Quoted 8 lines · Sean Christopherson

Fix a bug in runtime.bash that makes it not play nice with testcases that have multiple dependencies, and make x86's PMU tests depend on KVM enabling a vPMU.

Sean Christopherson (2):
runtime: Convert "check" from string to array so that iterating works x86/pmu: Make PMU testcases dependent on vPMU being enabled in KVM

[...]

Applied to kvm-x86 next. I'm OOO the rest of this week, thus the super quick application. I won't send a pull request until next week, so there's still plenty of time to object in case I've done something odd with runtime.bash in particular.

[1/2] runtime: Convert "check" from string to array so that iterating works

      https://github.com/kvm-x86/kvm-unit-tests/commit/e1b27810b555
[2/2] x86/pmu: Make PMU testcases dependent on vPMU being enabled in KVM
      https://github.com/kvm-x86/kvm-unit-tests/commit/dbbfaf80b8ff

--
https://github.com/kvm-x86/kvm-unit-tests/tree/next