On Jul 6, 2022, at 5:02 PM, Jim Mattson <jmattson@xxxxxxxxxx> wrote: > On Wed, Jun 29, 2022 at 7:37 PM Yang, Lixiao <lixiao.yang@xxxxxxxxx> wrote: >> This patch can fix the bug. I tried kvm-unit-tests vmx with your patch ten times on Ice lake and Cooper lake and the failure didn't happen. Thanks Jim! >> -----Original Message----- >> From: Jim Mattson <jmattson@xxxxxxxxxx> >> Sent: Wednesday, June 29, 2022 10:57 AM >> To: kvm@xxxxxxxxxxxxxxx; pbonzini@xxxxxxxxxx; Yang, Lixiao <lixiao.yang@xxxxxxxxx>; nadav.amit@xxxxxxxxx >> Cc: Jim Mattson <jmattson@xxxxxxxxxx> >> Subject: [kvm-unit-tests PATCH] x86: VMX: Fix the VMX-preemption timer expiration test >> >> When the VMX-preemption timer fires between the test for >> "vmx_get_test_stage() == 0" and the subsequent rdtsc instruction, the final VM-entry to finish the guest will inadvertently update vmx_preemption_timer_expiry_finish. >> >> Move the code to finish the guest until after the calculations involving vmx_preemption_timer_expiry_finish are done, so that it doesn't matter if vmx_preemption_timer_expiry_finish is clobbered. >> >> Signed-off-by: Jim Mattson <jmattson@xxxxxxxxxx> > > Reported-by: Nadav Amit <nadav.amit@xxxxxxxxx> > Tested-by: Lixiao Yang <lixiao.yang@xxxxxxxxx> Thank you, Jim. Sorry that I don’t have the time to test the patch right now, but I trust you and Lixiao. :)