diff mbox series

[kvm-unit-tests,v3,1/9] nVMX: Add "nop" after setting EFLAGS.TF to guarantee single-step #DB

Message ID 20221005235212.57836-2-seanjc@google.com (mailing list archive)
State New, archived
Headers show
Series x86: n{VMX,SVM} exception tests | expand

Commit Message

Sean Christopherson Oct. 5, 2022, 11:52 p.m. UTC
Add a "nop" after enabling single-stepping in vmx_l2_db_test() to ensure
a #DB is generated in the scope of the function even if the helper is
inlined.  Enabling single-step #DBs have a one-instruction delay, e.g. if
the function were inlined and the caller generated a "terminal" VM-Exit
immediately after invoking the helper, then no #DB would be generated.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 x86/vmx_tests.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

diff --git a/x86/vmx_tests.c b/x86/vmx_tests.c
index aa2ecbb..3e3d699 100644
--- a/x86/vmx_tests.c
+++ b/x86/vmx_tests.c
@@ -10745,6 +10745,7 @@  static void vmx_l2_bp_test(void)
 static void vmx_l2_db_test(void)
 {
 	write_rflags(read_rflags() | X86_EFLAGS_TF);
+	asm volatile("nop");
 }
 
 static uint64_t usermode_callback(void)