On Wed, 07 Jun 2023 14:09:53 -0700, Sean Christopherson wrote: > Fix bugs in the LBRV tests, and try to make them a bit less painful to > debug (goes from "excruitating" to just "awful"). The tests have been > failing on our Milan systems for quite some time, but debugging them was > painful and I wasn't sufficiently motivated until I wanted to clean up > KVM's code :-/ > > The Milan failures are due to AMD shoving a "mispredict" bit in the LBR > records, i.e. the tests fail if the CPU mispredicts the branch being > tested. Debug was especially difficult because the tests also neglected > to setup a guest stack, i.e. adding debug code created a completely > different failure that looked similar at first glance. > > [...] Applied quickly to kvm-x86 next, as I'm OOO the rest of this week. I won't send a pull request until sometime next week, e.g. if anyone objects to putting the assertion macros in common util.h. [1/6] x86: nSVM: Set up a guest stack in LBRV tests https://github.com/kvm-x86/kvm-unit-tests/commit/bef5a3677b60 [2/6] lib: Expose a subset of VMX's assertion macros https://github.com/kvm-x86/kvm-unit-tests/commit/11e5dc0f9ed4 [3/6] x86: Add defines for the various LBR record bit definitions https://github.com/kvm-x86/kvm-unit-tests/commit/691df8f964df [4/6] x86: nSVM: Ignore mispredict bit in LBR records https://github.com/kvm-x86/kvm-unit-tests/commit/3ffa0914672e [5/6] x86: nSVM: Replace check_dbgctl() with TEST_EXPECT_EQ() in LBRV test https://github.com/kvm-x86/kvm-unit-tests/commit/d8849d8f3702 [6/6] x86: nSVM: Print out RIP and LBRs from VMCB if LBRV guest test fails https://github.com/kvm-x86/kvm-unit-tests/commit/11c7d0604a50 -- https://github.com/kvm-x86/kvm-unit-tests/tree/next