mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] KVM: selftests: Add back the missing check of MONITOR/MWAIT availability
@ 2025-06-20  6:22 Chenyi Qiang
  2025-06-25 22:25 ` Sean Christopherson
  0 siblings, 1 reply; 2+ messages in thread
From: Chenyi Qiang @ 2025-06-20  6:22 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Zide Chen
  Cc: Chenyi Qiang, kvm, linux-kernel, Xuelian Guo

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/20240411210237.34646-1-zide.chen@intel.com/

Reported-by: Xuelian Guo <xuelian.guo@intel.com>
Fixes: 80fd663590cf ("selftests: kvm: revamp MONITOR/MWAIT tests")
Signed-off-by: Chenyi Qiang <chenyi.qiang@intel.com>
---
 tools/testing/selftests/kvm/x86/monitor_mwait_test.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/testing/selftests/kvm/x86/monitor_mwait_test.c b/tools/testing/selftests/kvm/x86/monitor_mwait_test.c
index 390ae2d87493..0eb371c62ab8 100644
--- a/tools/testing/selftests/kvm/x86/monitor_mwait_test.c
+++ b/tools/testing/selftests/kvm/x86/monitor_mwait_test.c
@@ -74,6 +74,7 @@ int main(int argc, char *argv[])
 	int testcase;
 	char test[80];
 
+	TEST_REQUIRE(this_cpu_has(X86_FEATURE_MWAIT));
 	TEST_REQUIRE(kvm_has_cap(KVM_CAP_DISABLE_QUIRKS2));
 
 	ksft_print_header();
-- 
2.43.5


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

* Re: [PATCH] KVM: selftests: Add back the missing check of MONITOR/MWAIT availability
  2025-06-20  6:22 [PATCH] KVM: selftests: Add back the missing check of MONITOR/MWAIT availability Chenyi Qiang
@ 2025-06-25 22:25 ` Sean Christopherson
  0 siblings, 0 replies; 2+ messages in thread
From: Sean Christopherson @ 2025-06-25 22:25 UTC (permalink / raw)
  To: Sean Christopherson, Paolo Bonzini, Zide Chen, Chenyi Qiang
  Cc: kvm, linux-kernel, Xuelian Guo

On Fri, 20 Jun 2025 14:22:18 +0800, Chenyi Qiang wrote:
> 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/20240411210237.34646-1-zide.chen@intel.com/
> 
> [...]

Applied to kvm-x86 fixes, thanks!

[1/1] KVM: selftests: Add back the missing check of MONITOR/MWAIT availability
      https://github.com/kvm-x86/linux/commit/0048ca5e9945

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

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

end of thread, other threads:[~2025-06-25 22:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-06-20  6:22 [PATCH] KVM: selftests: Add back the missing check of MONITOR/MWAIT availability Chenyi Qiang
2025-06-25 22:25 ` Sean Christopherson

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

all inboxes | Powered by JetHome®