Skip to content

Commit 0048ca5

Browse files
Qiangcysean-jc
authored andcommitted
KVM: selftests: Add back the missing check of MONITOR/MWAIT availability
The revamp of monitor/mwait test missed the original check of feature availability [*]. If MONITOR/MWAIT is not supported or is disabled by IA32_MISC_ENABLE on the host, executing MONITOR or MWAIT instruction from guest doesn't cause monitor/mwait VM exits, but a #UD. [*] https://lore.kernel.org/all/[email protected]/ Reported-by: Xuelian Guo <[email protected]> Fixes: 80fd663 ("selftests: kvm: revamp MONITOR/MWAIT tests") Signed-off-by: Chenyi Qiang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Sean Christopherson <[email protected]>
1 parent 47bb584 commit 0048ca5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
7474
int testcase;
7575
char test[80];
7676

77+
TEST_REQUIRE(this_cpu_has(X86_FEATURE_MWAIT));
7778
TEST_REQUIRE(kvm_has_cap(KVM_CAP_DISABLE_QUIRKS2));
7879

7980
ksft_print_header();

0 commit comments

Comments
 (0)