Skip to content

Commit 72cd4de

Browse files
ZideChen0sean-jc
authored andcommitted
KVM: selftests: Make monitor_mwait require MONITOR/MWAIT feature
If this feature is not supported or is disabled by IA32_MISC_ENABLE on the host, executing MONITOR or MWAIT instruction from the guest doesn't cause monitor/mwait VM exits, but a #UD. So, we need to skip this test if CPUID.01H:ECX[3] is cleared. Signed-off-by: Zide Chen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 201142d commit 72cd4de

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ int main(int argc, char *argv[])
7575
struct ucall uc;
7676
int testcase;
7777

78+
TEST_REQUIRE(this_cpu_has(X86_FEATURE_MWAIT));
7879
TEST_REQUIRE(kvm_has_cap(KVM_CAP_DISABLE_QUIRKS2));
7980

8081
vm = vm_create_with_one_vcpu(&vcpu, guest_code);

0 commit comments

Comments
 (0)