Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: Make monitor_mwait require MONITOR/MWAIT feature
@ 2024-04-11 21:02 Zide Chen
  2024-04-29 20:45 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Zide Chen @ 2024-04-11 21:02 UTC (permalink / raw)
  To: linux-kselftest; +Cc: seanjc, pbonzini, Zide Chen

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 <zide.chen@intel.com>
---
 tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c b/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c
index 853802641e1e..cdbfcf7cac5c 100644
--- a/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c
+++ b/tools/testing/selftests/kvm/x86_64/monitor_mwait_test.c
@@ -75,6 +75,7 @@ int main(int argc, char *argv[])
 	struct ucall uc;
 	int testcase;
 
+	TEST_REQUIRE(this_cpu_has(X86_FEATURE_MWAIT));
 	TEST_REQUIRE(kvm_has_cap(KVM_CAP_DISABLE_QUIRKS2));
 
 	vm = vm_create_with_one_vcpu(&vcpu, guest_code);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-04-29 21:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-11 21:02 [PATCH] KVM: selftests: Make monitor_mwait require MONITOR/MWAIT feature Zide Chen
2024-04-29 20:45 ` Sean Christopherson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox